This project has moved and is read-only. For the latest updates, please go here.

NotifyIcon Not Calling Registered Events

Feb 28, 2008 at 9:33 PM
I can't get the menu items to call the registered event. Here is my xaml:

<av:NotifyIcon Name="notifyIcon" Icon="{Binding Icon}" Text="{Binding Title}" Grid.ColumnSpan="2">
<FrameworkElement.ContextMenu>
<ContextMenu>
<MenuItem Header="Open ..." MouseUp="MenuItem_MouseUp"/>
<MenuItem Header="About ..." />
<MenuItem Header="Exit" />
</ContextMenu>
</FrameworkElement.ContextMenu>
</av:NotifyIcon>

Here is my code:

private void MenuItem_MouseUp(object sender, MouseButtonEventArgs e)
{
this.WindowState = WindowState.Normal;
this.Visibility = Visibility.Visible;
this.Focus();
}

But when I select the menu item for Open, the method will not get called. I have tried several different events and can't get any of them to work. It is weird because if I choose Navigate to Event Handler in the XAML editor, it goes right to the method in the code behind file. Also, if I map the MouseUp event for the NotifyIcon control itself to the same method, it works just fine. But, I can't get the MenuItems to call the appropriate event handlers.

Thanks.
Mar 4, 2008 at 8:19 AM
I had been waiting for aelija to take this one, but I guess he's not responding. I just did a little test and instead of using the MouseUp event, try the 'Click' event, this seems to be working.