【发布时间】:2014-03-26 02:24:32
【问题描述】:
按下按钮时,我选择一个用户控件并将 ItemsSource 设置为 null
CategoriesListBox.ItemsSource = null;
代码一运行,就会触发一个 SelectionChanged 事件
private void CategoriesListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{}
-
<Custom:SurfaceListBox
x:Name="CategoriesListBox"
ManipulationDelta="CategoriesListBox_ManipulationDelta"
IsManipulationEnabled="True"
SelectionChanged="CategoriesListBox_SelectionChanged"
ItemTemplate="{DynamicResource CategoriesUnselectedDataTemplate}"
SelectionMode="Single">
</Custom:SurfaceListBox>
我需要避免这种情况,并且没有触发 _SelectionChanged。
知道如何解决这个问题吗?
【问题讨论】:
-
去掉 _SelectionChanged ,就这么简单
-
当用户点击 Custom:SurfaceListBox 时我需要 SelectionChanged