I'm trying to combine the NotifyIcon-WPF and ModernUI for WPF into a new, simple WPF app. This is a proof-of-concept type of app. At this point I'm not using MVVM; everything at this point is code-behind.
I'm trying to get a modern button to close a window that has a user control on it, the ModernButton is on the user control. First I implemented the Click event, but that didn't work. Next I tried the ModernButton's MouseDown event, but that too didn't work. So next I set a breakpoint in both events to see if they ever fired; the breakpoints were never hit. I don't understand why not.
Here's the XAML:
<mui:ModernButton EllipseDiameter="17"
IconWidth="15"
IconHeight="15"
x:Name="CloseButton"
IconData="{StaticResource CancelIconData}"
HorizontalAlignment="Right"
ToolTip="Close toast message"
MouseDown="CloseButton_MouseDown"
Click="CloseButton_Click" />
And here is the relevant C# code behind events:
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
//the tray icon assigned this attached property to simplify access
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
taskbarIcon.CloseBalloon();
}
private void CloseButton_MouseDown(object sender, MouseButtonEventArgs e)
{
//the tray icon assigned this attached property to simplify access
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
taskbarIcon.CloseBalloon();
}