我在一个TabItem里放置了一个ComboBox。 问题在于,当我选择任何ComboBoxItem时,TabControl_SelectionChanged事件会被触发。而我在这个事件中有一些函数,不希望在我更改ComboBox选项时执行。
<TabControl x:Name="tb" HorizontalAlignment="Left" Height="299" Margin="10,10,0,0" VerticalAlignment="Top" Width="497" SelectionChanged="TabControl_SelectionChanged">
<TabItem x:Name="tbi1" Header="TabItem">
<Grid Background="#FFE5E5E5">
<Label x:Name="lbl" Content="Label" Margin="196,86,172,148"/>
<ComboBox HorizontalAlignment="Left" Margin="51,162,0,0" VerticalAlignment="Top" Width="120">
<ComboBoxItem Content="ComboBoxItem"/>
<ComboBoxItem Content="ComboBoxItem"/>
<ComboBoxItem Content="ComboBoxItem"/>
</ComboBox>
</Grid>
</TabItem>
<TabItem x:Name="tbi2" Header="TabItem">
<Grid Background="#FFE5E5E5"/>
</TabItem>
</TabControl>
编辑: 另外,当我将鼠标悬停在选项卡项目内的任何控件上时,也会出现这个问题,因为它同时悬停在选项卡项目上。