You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After a bit of tinkering I found out that whether FlipView.SelectedIndex is attached to a Binding, changing the active Tab will make it go back to Index 0. However, this will only happen once. If you change the Tab and then go back, FlipView will no longer reset back to Index 0 after you change tabs.
I'm experiencing this bug in my own project, which you can access through https://github.com/berkay2578/nfsw-server. You can find the code-behind related to the FlipView in the MainWindow.xaml.cs on the lines 104-131; or:
#region FlipViewPersona
FlipViewPersonaImage.HideControlButtons();
Grid[] aFlipViewAvatarArray = new Grid[28];
for (int i = 0; i < 28; i++)
{
Grid Grid_FlipViewDummy;
Image Image_FlipViewDummy;
Image_FlipViewDummy = new Image() { Margin = new Thickness(7d), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Stretch = Stretch.Uniform, Source = (ImageSource)BitmapFrame.Create(new Uri("pack://application:,,,/OfflineServer;component/images/NFSW_Avatars/Avatar_" + i.ToString() + ".png", UriKind.Absolute)) };
Grid_FlipViewDummy = new Grid() { Margin = new Thickness(-8d) };
Grid_FlipViewDummy.Children.Add(Image_FlipViewDummy);
Image t1 = new Image() { Source = Image_FlipViewDummy.Source };
t1.Effect = new System.Windows.Media.Effects.BlurEffect() { Radius = 7.5d };
Grid_FlipViewDummy.Background = new VisualBrush((Visual)t1);
aFlipViewAvatarArray[i] = Grid_FlipViewDummy;
}
FlipViewPersonaImage.ItemsSource = aFlipViewAvatarArray;
Binding indexBind = new Binding()
{
Path = new PropertyPath("mPersona.shAvatarIndex"),
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
Mode = BindingMode.TwoWay,
Source = mCurrentSession
};
FlipViewPersonaImage.SelectedIndex = mCurrentSession.mPersona.shAvatarIndex;
BindingOperations.SetBinding(FlipViewPersonaImage, FlipView.SelectedIndexProperty, indexBind);
#endregion
If you have any questions, please ask and I will respond shortly thereafter.
Put Grids in them.(It should do it by default but just to make sure)
Put a FlipView into the first Tab's Grid.
Attach items to it through code-behind.
Launch application, change the active item of FlipView.
Change the active tab and go back.
FlipView will have Index set to 0.
In the current form of my project, just launch it. It will set Index to 0 even though application returns 27(mCurrentSession->mPersona->shAvatarIndex).
Add the binding to the FlipView_Loaded event.
When launched, it will have Index set to 27 correctly.
Change the tab, then change it back to "Persona". FlipView will have it's Index set to 0.
Operating System: Windows 10 x64, Windows 8.1 x64; both up-to-date Outcome: Resetting problem fixed for the FlipView, as it almost always returns back Index: 0.
The text was updated successfully, but these errors were encountered:
berkay2578
changed the title
FlipView SelectedIndex Binding bug
FlipView SelectedIndex resetting bug
Jan 30, 2016
petvetbr
added a commit
to petvetbr/MahApps.Metro
that referenced
this issue
Mar 2, 2016
Update:
After a bit of tinkering I found out that whether FlipView.SelectedIndex is attached to a Binding, changing the active Tab will make it go back to Index 0. However, this will only happen once. If you change the Tab and then go back, FlipView will no longer reset back to Index 0 after you change tabs.
I'm experiencing this bug in my own project, which you can access through https://github.com/berkay2578/nfsw-server. You can find the code-behind related to the FlipView in the MainWindow.xaml.cs on the lines 104-131; or:
If you have any questions, please ask and I will respond shortly thereafter.
Versions: 1.1.2-STABLE, 1.2.4-STABLE, 1.3.0-ALPHA028.
Environment: VS2015 Enterprise, .Net Framework 4.0
Steps:
Operating System: Windows 10 x64, Windows 8.1 x64; both up-to-date
Outcome: Resetting problem fixed for the FlipView, as it almost always returns back Index: 0.
The text was updated successfully, but these errors were encountered: