我正在尝试使用以下 xaml 将 RibbonGroup 和几个 RibbonButtons 绑定到我的视图模型:
<Style TargetType="{x:Type ribbon:RibbonGroup}" x:Key="RibbonGroupStyle">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="ItemContainerStyle" Value="{DynamicResource RibbonButtonStyle}" />
<Setter Property="ItemsSource" Value="{Binding Buttons}" />
</Style>
<Style TargetType="{x:Type ribbon:RibbonButton}" x:Key="RibbonButtonStyle">
<Setter Property="Label" Value="{Binding Header}" />
</Style>
这给了我以下错误,我可以理解,但是如何正确地将 RibbonButton 的标签绑定到我的视图模型?
A style intended for type 'RibbonButton' cannot be applied to type 'RibbonControl'.