-->

绑定RibbonComboBox.SelectionBoxItem(Bind RibbonCombo

2019-09-28 03:24发布

我试图在RibbonComboBox选择一个对象的属性项绑定。 我现在遇到的问题是,RibbonComboBox.SelectionBoxItem只是提供了一个get访问; 因此,我不能把它绑定到XAML什么。

任何想法如何将项目绑定到一个对象的属性? 我可以用一个普通的ComboBox有另一种更适当的控制?

xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"

<ribbon:RibbonComboBox
    ItemsSource="{Binding Source={StaticResource CollectionOfPossibleChoices}}"/
    SelectionBoxItem="{Binding Path=PropertyToBindTo}"/> <!--Not valid-->

Answer 1:

RibbonComboBox不同于组合框(我,也感到迷惑)。 尝试这个;

<ribbon:RibbonComboBox>
    <ribbon:RibbonGallery SelectedItem="{Binding Path=PropertyToBindTo}">
        <ribbon:RibbonGalleryCategory ItemsSource="{Binding Source={StaticResource CollectionOfPossibleChoices}}" />
    </ribbon:RibbonGallery>
</ribbon:RibbonComboBox>

MSDN参考



文章来源: Bind RibbonComboBox.SelectionBoxItem