Search code examples
c#wpfnotifyiconballoon-tip

WPF NotifyIcon Balloon not showing up


Okay guys, quite new to C# but I'm getting on with it just fine.

I've got an application minimised to the system tray and I'm using WPF NotifyIcon to do this. I'm trying to use the built in bubble tip feature.

Whilst I've got no errors, it just doesn't seem to be working.

My code is as follows:

    private void OnTaskBarMenuItemExitClick(object sender, RoutedEventArgs e)
    {
        m_isExplicitClose = true;//Set this to unclock the Minimize on close 

        this.Close();

        string title = "WPF NotifyIcon";
        string text = "This is a standard balloon";

        TaskBar.ShowBalloonTip(title, text, Properties.Resources.Server);
    }

What should happen is that when I close the application, it hides to the system tray (and does) but should also popup the BalloonTip (and doesn't).

Any ideas; I'm stumped? :(


Solution

  • There's some constraints on icon format and having done a TeamViewer session with the poster, we've come to the conclusion that it was the icon causing the issue.

    private void OnTaskBarMenuItemExitClick(object sender, RoutedEventArgs e)
    {
        m_isExplicitClose = true;//Set this to unclock the Minimize on close 
    
        this.Close();
    
        string title = "WPF NotifyIcon";
        string text = "This is a standard balloon";
    
        TaskBar.ShowBalloonTip(title, text, BalloonIcon.Error);
    }
    

    Worked correctly and resolved the issue of the balloon not appearing.