Reputation: 88217
I wonder if I am doing something wrong? My CurrentChanged does not seem to trigger. It only triggers on application start
ListItems = new ObservableCollection<string>();
ListItems.Add("hello");
ListItems.Add("world");
ListItems.Add("foo");
ListItems.Add("bar");
ListItems.Add("baz");
viewSource = CollectionViewSource.GetDefaultView(ListItems);
viewSource.CurrentChanged += (o, e) =>
{
MessageBox.Show((string)viewSource.CurrentItem);
};
Upvotes: 0
Views: 1112
Reputation: 88217
Oh I found out the problem. I must set IsSynchronizedWithCurrentItem="True"
Upvotes: 2