I have a menu in wpf that has an input box and a button on it. Once the user clicks the button I need to close the menu.
Is there a way to do this?
<Menu x:Name='MainMenu'> <MenuItem Header='Main'> <MenuItem Header='SubMenu' x:Name='SubMenu'> <StackPanel Orientation='Horizontal'> <TextBox Width='50' x:Name='TextBox' /> <Button Content='Click Me and Close' x:Name='Button' IsDefault='True'/> </StackPanel> </MenuItem> </MenuItem>
Thanks, Jon
Get hold of the
MenuItemand do:Easy way to get hold of it:
Code-behind: