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
MSDN
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.
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>
Resulting Ribbon:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With