Alessandro Del Sole's Blog

/* A programming space about Microsoft® .NET® */
posts - 159, comments - 0, trackbacks - 0

My Links


Your host

This is me! This space is about Microsoft® .NET® and Microsoft® Visual Basic development. Enjoy! :-)

These postings are provided 'AS IS' for entertainment purposes only with absolutely no warranty expressed or implied and confer no rights.

Microsoft MVP

My MVP Profile

I'm a VB!

Watch my interview in Seattle

My new book on VB 2015!

Pre-order VB 2015 Unleashed Pre-order my new book "Visual Basic 2015 Unleashed". Click for more info!

My new book on LightSwitch!

Visual Studio LightSwitch Unleashed My book "Visual Studio LightSwitch Unleashed" is available. Click the cover!

Your visits

Follow me on Twitter!

CodePlex download Download my open-source projects from CodePlex!

Article Categories


Post Categories

.NET Framework


Help Authoring

Microsoft & MSDN

Setup & Deployment

Visual Basic 2005/2008/2010

WPF: menus with different fonts

When implementing menus in WPF applications, you can assign different fonts (each with different properties) to each single header or command.

Consider the following XAML:

  <DockPanel LastChildFill="True">

    <Menu DockPanel.Dock="Top" VerticalAlignment="Top">

      <MenuItem Name="FileMenu" Header="File" FontFamily="Script MT Bold" FontSize="14" FontStyle="Italic" FontWeight="Medium">


        <MenuItem Name="FileVivaldiCommand" Header="Command with Vivaldi Font" FontFamily="Vivaldi" FontSize="16" FontWeight="Heavy">



              <GradientStop Color="Red" Offset="0" />

              <GradientStop Color="Orange" Offset="0.5" />

              <GradientStop Color="Yellow" Offset="1" />







We have drawn a File menu whose layout is set using the Script TM Bold font, with size of 14, italic, medium intensity. The Name has been assigned if you would interact with the graphical object via managed code.

The first command of the File menu is even identified with a Name attribute and is shown according to the Vivaldi font with size of 16, heavy intensity. We've also added a particular feature, a gradient background for this menu command. If you are a fan of this blog, you know very well this programming technique.

This is the result we obtain running the application:



Print | posted on martedì 14 aprile 2009 14:21 | Filed Under [ Windows Presentation Foundation ]


No comments posted yet.

Post Comment

Please add 6 and 4 and type the answer here:

Powered by:
Powered By Subtext Powered By ASP.NET