首先导致问题的代码:
<my:Ribbon x:Name="ribbon">
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="SelectionChanged">
<command:EventToCommand Command="{Binding RibbonTabSelectedCommand}" PassEventArgsToCommand="True" />
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
<my:RibbonTab Header="Chart" Tag="Chart"
IsEnabled="{Binding SelectedSearchResult,
Converter={StaticResource nullToBoolConverter}}">
<my:RibbonGroup>
<ComboBox ItemsSource="{Binding SelectedSearchResult.Values}"
SelectedValue="{Binding SelectedFrequency, Mode=TwoWay}">
</ComboBox>
</my:RibbonGroup>
</my:RibbonTab>
</my:Ribbon>
我想要做的是使用MvvmLight框架处理RibbonTab的SelectionChanged,并将事件转换为视图模型命令。它很棒。 问题是在添加ComboBox之后,组合框的选择也会被此代码处理。而且我不希望这种情况发生。功能区是Microsoft WPF功能区中的功能区。
我尝试了这个,但它不起作用:
<interactivity:EventTrigger EventName="SelectionChanged" SourceName="ribbon" SourceObject="{Binding ElementName=ribbon}" >
任何想法?谢谢!