I have a ListView to which item source is given from the viewModel. On a button click the selected items will be changed. Now the problem is, the previous item of Listview is displaying as selected. When I observed, the selected item is set to the expected value but the anchor item is having previously selected Item. I am suspecting that due to the anchor Item the item is displaying as selected.
In the above screenshot, test t2 is currently selected one Test t3 is the anchor item, which I have selected previously.
here is my listView
<ListView Grid.Row="2" x:Name="AllUsers" ItemsSource="{Binding Source={StaticResource Users}}"
HorizontalAlignment="Stretch" Cursor="Hand" AllowDrop="False" ForceCursor="True" MouseLeftButtonUp="OnUsersSelected"
VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
<ListView.ItemTemplate>
<DataTemplate>
// Some code
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Can someone help me to fix this, please.