有谁知道为什么在将列表框的 ItemSoure 绑定到 CellectionViewSource 的 View 属性时会自动触发 SelectionChanged 事件?我该如何阻止它?谢谢。代码如下:
<ListBox ItemTemplate="{StaticResource ListboxDataTemplate}" x:Name="AllListBox" SelectedItem=" Binding Master.SelectedTask,Mode=TwoWay}" ItemsSource="{Binding Master.ViewSource.View}" />
//Code-behind
CollectionViewSource ViewSource = new CollectionViewSource();
ViewSource.Source = Tasks;
ViewSource.SortDescriptions.Add(new SortDescription("Model.t_state", ListSortDirection.Ascending));
ViewSource.SortDescriptions.Add(new SortDescription("Model.t_createtime", ListSortDirection.Descending));
ViewSource.SortDescriptions.Add(new SortDescription("Model.t_importance", ListSortDirection.Descending));
ViewSource.SortDescriptions.Add(new SortDescription("Model.t_nam", ListSortDirection.Ascending));