Tuesday, May 28, 2013

FlipView: first item always briefly visible

An alternative temporary and not very intrusive fix consists in :


1.- Declaring your <FlipView x:Name="flipView" Opacity=0.0 ...>


2.- Having the following code-behind:



bool isLoaded = false;
private void flipView_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
if (this.isLoaded && flipView.Opacity != 1.0)
Dispatcher.RunIdleAsync((a) => { flipView.Opacity = 1.0; }).AsTask();
}
int INDEX_ITEM_DISPLAYED_INITIALLY = 1; // '1' should be the index mandated by _your_ business case
private void flipView_Loaded_1(object sender, RoutedEventArgs e)
{
this.isLoaded = true;
flipView.SelectedIndex = this.INDEX_ITEM_DISPLAYED_INITIALLY;
}
private void flipView_Unloaded_1(object sender, RoutedEventArgs e)
{
this.isLoaded = false;
}










No comments:

Post a Comment