如何在RibbonApplicationMenu的开头设置文本 [英] How to set text at the head of a RibbonApplicationMenu
问题描述
我正在尝试在RibbonApplicationMenu的顶层添加文本(尝试在其中获取类似于Word或Outlook的单词"File").似乎Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenu
http://msdn .microsoft.com/en-us/library/microsoft.windows.controls.ribbon.ribbonapplicationmenu.aspx 支持SmallImageSource,但不支持文本属性.设置Label
属性不适用于此问题.
I'm trying to have text in the top level of a RibbonApplicationMenu (trying to the get the word "File" there similar to Word or Outlook). It seems the Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenu
http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribbon.ribbonapplicationmenu.aspx supports a SmallImageSource but no text property. Setting the Label
property doesn't work for this problem.
xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
<ribbon:RibbonApplicationMenu Label="File"> <!--doesn't set the label -->
</ribbon:RibbonApplicationMenu>
目标是在下面带圆圈的区域中显示文件"一词.
The goal is to have the word "File" appear in the circled area below.
推荐答案
(对我而言)最简单的解决方案是插入 DrawingImage . glyphrun.aspx"rel =" nofollow noreferrer> GlyphRun 内.在单独的帖子中,询问如何获取GlyphRun的AdvanceWidths和GlyphIndicies .结果如下
The simplest solution (to me) was to insert a DrawingImage with a GlyphRun inside. On a separate post is asked how to get the AdvanceWidths and GlyphIndicies for the GlyphRun. The result is below
<ribbon:RibbonApplicationMenu.SmallImageSource>
<DrawingImage>
<DrawingImage.Drawing>
<GlyphRunDrawing ForegroundBrush="White">
<GlyphRunDrawing.GlyphRun>
<GlyphRun
CaretStops="{x:Null}"
ClusterMap="{x:Null}"
IsSideways="False"
GlyphOffsets="{x:Null}"
GlyphIndices="41 76 79 72"
FontRenderingEmSize="12"
DeviceFontName="{x:Null}"
AdvanceWidths="5.859375 2.90625 2.90625 6.275390625">
<GlyphRun.GlyphTypeface>
<GlyphTypeface FontUri="C:\WINDOWS\Fonts\SEGOEUI.TTF"/>
</GlyphRun.GlyphTypeface>
</GlyphRun>
</GlyphRunDrawing.GlyphRun>
</GlyphRunDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</ribbon:RibbonApplicationMenu.SmallImageSource>
生成的功能区:
这篇关于如何在RibbonApplicationMenu的开头设置文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!