Dropdown Menu in WPF Toolbar

Dropdown Menu in WPF Toolbar

You could try placing a Menu & MenuItem inside the Toolbar. Ive had to use Menus and MenuItem trees in various parts of the interface (besides classical menus) to get the dropdown menu behavior. You can tweak the control template of the menu to sculpt the look and feel to look however you like and completely abandon the vanilla menu look and feel.

Heres some XAML to show a simple implementation:

<Window x_Class=Window1
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns_x=http://schemas.microsoft.com/winfx/2006/xaml
Title=Window1 Height=300 Width=300>
<StackPanel>
    <ToolBar>
            <Button Content=Button1></Button>
            <Button Content=Button2></Button>
            <Menu>
                <MenuItem Header=Menu>
                    <MenuItem Header=MenuItem1/>
                </MenuItem>
            </Menu>
    </ToolBar>
</StackPanel>

Dropdown Menu in WPF Toolbar

Leave a Reply

Your email address will not be published.