问题描述
我正在尝试在应用程序中使用RibbonGallery,但是在加载包含图库的选项卡时,在运行时出现此错误:
I am trying to use a RibbonGallery in my application, but I get this error at runtime, when the tab which contains the gallery is loaded:
有什么不对的地方吗?
代码如下:
<ribbon:RibbonGallery MaxColumnCount="1">
<ribbon:RibbonGalleryCategory>
<ribbon:RibbonGalleryItem Content="Green" Foreground="Green" />
<ribbon:RibbonGalleryItem Content="Blue" Foreground="Blue" />
<ribbon:RibbonGalleryItem Content="Orange" Foreground="Orange" />
</ribbon:RibbonGalleryCategory>
</ribbon:RibbonGallery>
推荐答案
RibbonGallery控件必须放置在可以利用RibbonGallery优势的控件中,例如RibbonSplitButton或RibbonComboBox.这是在RibbonComboBox中使用画廊的示例:
The RibbonGallery control must be placed within a control that can take advantage of the RibbonGallery, like a RibbonSplitButton or a RibbonComboBox. Here is an example of using a gallery in a RibbonComboBox:
<ribbon:RibbonComboBox Label="1"
SmallImageSource="Images/RightArrowShort_Green16.png"
SelectionBoxWidth="62"
VerticalAlignment="Center"
IsEditable="True" >
<ribbon:RibbonGallery SelectedValue="Green"
SelectedValuePath="Content"
MaxColumnCount="1">
<ribbon:RibbonGalleryCategory>
<ribbon:RibbonGalleryItem Content="Green" Foreground="Green" />
<ribbon:RibbonGalleryItem Content="Blue" Foreground="Blue" />
<ribbon:RibbonGalleryItem Content="Orange" Foreground="Orange" />
</ribbon:RibbonGalleryCategory>
</ribbon:RibbonGallery>
</ribbon:RibbonComboBox>
如果控件是从RibbonMenuButton派生的,则由于具有HasRibbon属性,它可以包含RibbonGallery.
If a control is derived from RibbonMenuButton then it can contain a RibbonGallery because of the HasRibbon property.
这篇关于RibbonGroupsPanel ...仅接受IProvideStarLayoutInfo实例吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!