How to know if the element is on the screen? - windows-phone-7

I have a horizontal ListBox with Images, which are pretty big and take 80% of the screen. User scrolls through this ListBox and images change quickly, and I'd like to highlight the image which is actually on the screen. What is the best way to do it?

Personally, I would use the class proposed by AnthonyWJones in this topic:
Restoring exact scroll position of a listbox in Windows Phone 7
The idea remains the same. You'll just change the vertical listbox to horizontal listbox.
Thus, you can recover the exact position of your listbox.

Related

Famo.us images carousel

How can I create simple image carousel. Let's say I have GridView with two rows and one column. I want to create image carousel in upper row. Can I do that with ScrollView. Any sugestions?
You have the right idea. You can use gridLayout just to keep your sizing in line, and using scrollView is perfectly fine.
I do not know exactly how you imagine such a carousel working, but one option to be aware of in scrollview is the 'paginated' option. This allows you to easily define target positions for scrollview to stop and snap to, similar to a scroll picker on native. Or if you want the sources definition..
* #param {Boolean} [paginated=false] A paginated scrollview will scroll through items discretely
* rather than continously.
The next thing you may want to think about is how a carousel goes round and round and never reaches an end like scrollview would. There is no option for this by default, but I found a way it can easily be done. It may be a bit trickier with smaller images, but here is an example I did for a infinite panorama.
Transforming Panoramas for Virtual Tours with famo.us, has it been done?
The trick was to use a second duplicate image trailing the scrollview and when scrollview was in the right position, we could jump it back to the beginning, with no visual evidence to the user.
Here is the live example..
http://higherorderhuman.com/examples/infinite.html
Hope this helps you get started!

Windows store apps Hub Control Horizontal Offset

How is it possible to determine the horizontal offset of the Windows 8.1 HubControl?
I would like to adjust the margin of my title by the amount of horizontal offset.
Interestingly I notice in the Bing News app that the title 'Bing News' starts off white when it is over the lead image. However, when you scroll right, and the title is now over the application's (light) background (having scrolled past the image), the title background colour now changes to black.
See image below. Shows the top most part of the screen. Images 1-3 show when the page has scrolled right and the BING NEWS title has changed colour once it is no longer over the image.
I assume this is done via the offset again so I hope that my idea is possible.
The Hub control has a child element which is a ScrollViewer. You can parse the visual tree to retrieve the ScrollViewer, or you can use some neat extensions such as the ones in WinRTXamlToolkit which allow you to do a call such as myHubControl.GetFirstDescendentOfType<ScrollViewer>(). Then, you can retrieve the HorizontalOffset from this object.

vb6 set listview item/subitem image

I have a listview that I want to implement the effect seen in this image:
The listview hides some items like in the image below except a
password is entered. I know that item and subitem image are usually
left aligned.
How do I set the item and subitem image to cover the whole text are of the list view as shown?
EDIT
I got a tip of how to draw the pattern in this pics from here, but how do I draw this on a listitem?
You'll be better off using subclassing and owner/custom drawing. That will allow you to draw that entire row and let the listview deal with the rest.

How to include canvas under panorama page in windows phone?

I have a panorama page with two panorama item and would like to include a canvas inside the second panorama item. So, when I do it, I get a overflow of the first panorama item in my canvas. As it should be made such that it takes around one and half page. So it should be like 2 and a half panorama page with two items a panorama item and a canvas item.
Make sure all the margin values are zero. Sometimes, Expression Blend will add margins to a child control to fit into the ItemTemplate of the panorama control. Remember a Canvas doesnt act like other components, it's contents are mapped to the pixel.
Also, if you are looking to make an item 1.5 page widths, consider changing the panorama item's orientation to horizontal.
Maybe put another canvas under the grid in your second panorama item?

How to prevent overflow text in a text block?

I'm trying to make an ebook reader. I want each page to scroll sideways (like the Pivot viewer does) but I can't get out how to figure out how many words need to be added to the text box on a screen to before it starts overflowing (I don't want the user to scroll vertically).
Any tips?
Thanks!
There is a Scrollable TextBlock which divide text into blocks of 2048px height. You can use their code to get text that will exactly fit into one page (800px, for example)
Creating Scrollable TextBlock for WP7
If you call the UIElement.Measure(Size) method, then check the UIElement.DesiredSize property, it will tell you the size of an element before it is rendered. You could add text, repeatedly measuring the rendered size.
However ... this will be pretty inefficient. It is much better if you can create a layout that performs what you require automatically.

Resources