我在ComboBox项目中使用SelectionChanged,但是当我再次选择相同的项目时,SelectionChanged函数不会触发,我需要它来执行此操作.我怎么能告诉它不要选择我做的选择.
private void ComboBox_SelectionChanged4(object sender, SelectionChangedEventArgs e)
{
//do some stuff
}
Run Code Online (Sandbox Code Playgroud)
XAML:
<ComboBox Height="30" Name="Combo4" Style="{StaticResource CategoryComboBox}" SelectionChanged="ComboBox_SelectionChanged4" Grid.ColumnSpan="2" Grid.Column="0">
<ComboBoxItem Content="ComboBox Item 1 (Example)" />
<ComboBoxItem Content="ComboBox Item 2 (Example)" />
<ComboBoxItem Content="ComboBox Item 3 (Example)" />
<ComboBoxItem Content="ComboBox Item 4 (Example)" />
</ComboBox>
Run Code Online (Sandbox Code Playgroud)
添加项目:
for (int i = 0; i < Pr4.Count(); i++)
{
ComboBoxItem item = new ComboBoxItem();
item.Content = Pr4[i];
Combo4.Items.Add(item);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3784 次 |
| 最近记录: |