【发布时间】:2015-05-21 15:08:55
【问题描述】:
我已经开始使用 Microsoft Ribbon 控件,但当标签的文本超过 1 行时,我遇到了 RibbonButton 的问题
我的功能区代码如下:
<Ribbon x:Name="ribMainRibbon" SelectionChanged="ribMainRibbon_SelectionChanged" DockPanel.Dock="Top">
<Ribbon.QuickAccessToolBar>
<RibbonQuickAccessToolBar x:Name="ribQuickAccessToolBar">
<RibbonButton SmallImageSource="/Media/Icons/New.png"/>
<RibbonButton SmallImageSource="/Media/Icons/Open.png"/>
<RibbonButton SmallImageSource="/Media/Icons/Save.png"/>
<RibbonButton SmallImageSource="/Media/Icons/Print.png"/>
</RibbonQuickAccessToolBar>
</Ribbon.QuickAccessToolBar>
<Ribbon.ApplicationMenu>
<RibbonApplicationMenu Visibility="Collapsed">
</RibbonApplicationMenu>
</Ribbon.ApplicationMenu>
<RibbonTab Header="{DynamicResource MenuDesignOptions}">
<RibbonGroup>
<RibbonMenuButton LargeImageSource="/Media/Icons/ToolBar/PlaceHolder.png" Label="{DynamicResource MenuAutoCalc}" x:Name="rmbAutoCalc">
<RibbonMenuItem ImageSource="/Media/Icons/ToolBar/PlaceHolder2.png" Header="{DynamicResource MenuAutoCalc}" x:Name="rmiAutoCalc" Click="rmiAutoCalc_Click"/>
<RibbonMenuItem ImageSource="/Media/Icons/ToolBar/PlaceHolder.png" Header="{DynamicResource MenuManualCalc}" x:Name="rmiManualCalc" Click="rmiManualCalc_Click"/>
</RibbonMenuButton>
<RibbonMenuButton LargeImageSource="/Media/Icons/ToolBar/PlaceHolder.png" Label="{DynamicResource MenuEnglish}" x:Name="rmbUnits">
<RibbonMenuItem ImageSource="/Media/Icons/ToolBar/PlaceHolder2.png" Header="{DynamicResource MenuEnglish}" x:Name="rmiEnglishUnits" Click="rmiEnglishUnits_Click"/>
<RibbonMenuItem ImageSource="/Media/Icons/ToolBar/PlaceHolder.png" Header="{DynamicResource MenuMetric}" x:Name="rmiMetricUnits" Click="rmiMetricUnits_Click"/>
</RibbonMenuButton>
<RibbonButton LargeImageSource="/Media/Icons/ToolBar/PlaceHolder.png" Label="{DynamicResource MenuReverse}" x:Name="rbtReverse" Click="rbtReverse_Click">
</RibbonButton>
</RibbonGroup>
</RibbonTab>
以及相关的字符串资源:
<s:String x:Key="MenuReverse">Reverse System</s:String>
<s:String x:Key="MenuEnglish">Imperial Units</s:String>
<s:String x:Key="MenuAutoCalc">Auto Calc</s:String>
但是当我运行这段代码时,它最终看起来像这样:
所以我可以通过指定RibbonButton 的Height 属性来修复它,但这似乎是错误的修复。而且我知道您应该能够在这些按钮上有 2 行描述,因为 MS Word 和 Excel 都有它们:
【问题讨论】: