绑定 RibbonComboBox.SelectionBoxItem
我试图将 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-->
I'm trying to bind the item selected in a RibbonComboBox to a property of an object. The problem I'm encountering is that the RibbonComboBox.SelectionBoxItem only provides a get accessor; therefore, I cannot bind it to anything in the XAML.
Any ideas how to bind the item to the property of an object? I could use a regular ComboBox is there another more appropriate control?
xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
<ribbon:RibbonComboBox
ItemsSource="{Binding Source={StaticResource CollectionOfPossibleChoices}}"/
SelectionBoxItem="{Binding Path=PropertyToBindTo}"/> <!--Not valid-->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RibbonComboBox 与 ComboBox 不同(我也觉得这很令人困惑)。试试这个;
MSDN 参考
RibbonComboBox is unlike ComboBox (which i, also, find confusing). Try this;
MSDN Reference