Live Chat Icon For mobile
Live Chat Icon

How can I apply a Style to a Menu control on a ToolBar ?

Platform: WPF| Category: ItemsControl

You can apply a menu control style on a toolbar by using the Toolbar.MenustyleKey Property. This can be done with the following code snippet,

[XAML]
  <window.resources>
        <style x:key="{x:Static ToolBar.MenuStyleKey}" targettype="Menu">
            <Setter Property='FontSize' Value='14'/>
            <Setter Property='FontStyle' Value='Oblique'/>
            <Setter Property='FontWeight' Value='Bold'/>
            <Setter Property='Background' Value='AliceBlue'/>
        </style>
   </window.resources>
 
<grid>
   <toolbar>
            <menu>
                <menuitem header="File">
                    <menuitem header="New">
                        <menuitem header="Project">
                        <menuitem header="File">
                    </menuitem>
                </menuitem>
            </menuitem></menuitem></menu>
        </toolbar>
</grid>

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.