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);
};
Oh I found out the problem. I must set IsSynchronizedWithCurrentItem="True"
精彩评论