Quantcast
Channel: Avalon
Viewing all articles
Browse latest Browse all 20

WPF MenuItem hiding

$
0
0
Hi,

I would like to hide selected MenuItem on <Delete> key press without closing the menu.

My markup is:


<Menu>

<MenuItem Header="Menu">

<MenuItem Header="First" KeyDown="MenuItem_KeyDown"/>

<MenuItem Header="Second" KeyDown="MenuItem_KeyDown"/>

<MenuItem Header="Third" KeyDown="MenuItem_KeyDown"/>

</MenuItem>

</Menu>

where event handler is:

private void MenuItem_KeyDown(object sender, KeyEventArgs e)

{

if (e.Key == Key.Delete)

{

MenuItem mi = (MenuItem)sender...

Read more

Viewing all articles
Browse latest Browse all 20

Trending Articles