Tuesday, May 28, 2013

FlipView: first item always briefly visible

I'm using a Flipview to display a detailed view of items in a collection, much like in the standard Grid Application template. That is, the items are displayed in a gridview, and when one of the items is clicked, I navigate to a page that contains a FlipView, which is bound to the same group of items, and I set the selected item based on the navigationparameter passed to the page. This is exactly like in the application template.


However, the gridview always briefly selects and displays the very first item in the collection, and then switches to the selected item. Which means that for a fraction of a second, the first item is visible. It's short, but noticable. I checked the SelectionChanged event and indeed, as soon as you navigate to the page it fires, and the first item in the collection is in the SelectionChangedEventArgs.AddedItems collection. Then immediately after that it fires again for the item you actually selected.


Is there a way to prevent the FlipView from selecting and/or displaying the first item in the collection -before- you set the SelectedItem property? I've tried setting the flipview's visibility to collapsed and only setting it to visible when the navigation parameter matches the added item in SelectionChanged, but it's not working either. Any thoughts?


No comments:

Post a Comment