Click here to Skip to main content
14,733,541 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The WPF app is developed strictly in MVVM pattern

Let's say I have a List included 3 items in ViewModel

var Items = new List<item> { Item1, Item2, Item3}
<ListView Margin="5,5,5,20" SelectionMode="Single"
	SelectedValue="{Binding SelectedItemObj}"
        ItemsSource="{Binding Items, Mode=OneWay}">

And the user click on the grid on Item2
So, the SelectedValue = Item2

A service async updated the Items collection at seperate thread by

Items[1] = NewItem;

Because of that, the SelectedValue in the ListView is lost
And one of the side note is that the async update is very frequentPlease hope if there's

anyone who can suggest a solution for me

Million Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900