Why does FlipView ignore SelectedItem
windows-runtime, winrt-xaml, xaml
Solution
Try this
<FlipView
ItemsSource="{Binding Items}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
- your SelectedItem needs to be a TwoWay binding for it to work, since the value is set by both the control and the view model.
Problem
I'd like to use a FlipView to display some items and start showing a specific item. For this, I have defined a view model class: ``` class MyDataContext { public MyDataContext() { Items = new List<MyClass>(); Items.Add(new MyClass("1")); Items.Add(new MyClass("2")); Items.Add(new MyClass("3")); SelectedItem = Items[1]; } public List<MyClass> Items { get; set; } public MyClass SelectedItem { get; set; } } ``` As you can see, the selected item is not the first item. Now for the XAML: ``` <FlipView ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}"></FlipView> ``` However, when I run the app, the flip view shows the first item, not the second item. Is this intentional?, or is it a bug?