Drop Down List with WPF Menu Controls


Question

I am looking for a way to add a drop down list in WPF to a menu. This used to be really easy in winforms and so I am expecting you experts to know just now to do it in WPF. Thanks.

Sorry if this is a bad question, it is late and I don't want to think.

1
10
10/13/2008 6:29:34 AM

Accepted Answer

It is very easy to add any UIElement to any control, You can just add Combobox to a Menu control and create menu as bellow.

<Menu>
    <MenuItem Header="File">
        <MenuItem Header="Open"/>
        <MenuItem Header="Close"/>
        <Separator/>
        <ComboBox Width="85" Height="21.96" />
    </MenuItem>
</Menu>
25
8/3/2017 7:44:48 PM

While this is very easy to do as Jobi Joy has shown, I think it has horrible usability. The Menu control supports multiple levels of menu items and I would go down that route for UI consistency.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon