Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6904325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:02:51+00:00 2026-05-27T08:02:51+00:00

I have a wpf application that is using a NavigationWindow that allows me to

  • 0

I have a wpf application that is using a NavigationWindow that allows me to load pages within the MasterWindow.

I am trying to add the notifyicon feature http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx to my application that will allow me to display a notification window when I want.

I have added the taskbaritem to my navigationwindow

 <tb:TaskbarIcon x:Name="MyNotifyIcon" ToolTipText="My Application" IconSource="/Images/Icons/TB.ico"/>

I want to be able to create a helper class that can access MyNotifyIcon from any of the pages loaded. I was thinking something like

  public static void DisplayMessageArea(string messageToDisplay)
    {
        var balloon = new StandardNotification {BalloonMessage = messageToDisplay };

        //TaskbarIcon tb = (TaskbarIcon)MasterWindow.Resources.FindName("MyNotifyIcon");
        //tb.ShowCustomBalloon(balloon,PopupAnimation.Slide,4000);

    }

However I don’t know the correct way to find the controller “MyNotifyIcon” from my helper class.

Can someone point me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:02:51+00:00Added an answer on May 27, 2026 at 8:02 am

    I’ve never seen that NotifyIcon before (kinda cool, by the way), but I took a look at its API. What I would suggest is that you not bother naming that control and trying to find it in your code. Instead, in your main navigation window, set its datacontext to a helper class that you define, and bind to its iconsource, tooltiptext, etc:

    <tb:TaskbarIcon DataContext="{Binding SomeViewModel}"
      IconSource="..."
      ToolTipText="{Binding Text}"
      Visibility="{Binding IsVisible, Converter=...}" />
    

    (More about value converters here).

    Now, the “SomeViewModel” class will implement INotifyPropertyChanged and expose properties like:

    bool IsVisible { get; set; }
    string Text { get; set; }
    

    …except that these properties will have actual getters/setters and raise the property changed event.

    With this approach, you don’t need to tell your presentation layer to go looking in your View layer, which isn’t really ideal. It’s better if your view (XAML) knows about your presentation (code), but not vice-versa, as this loosens coupling. In this case, it loosens coupling by virtue of the fact that your actual code does not depend on the existence of some named control declared in XAML.

    As to how to get at this helper view model, you can pass a reference to it around to the various classes that can set it, or you can have the sub-controls of the navigation window raise events that the nav window listens for, or you can go with the approach that you had in mind, which is to define a static method on the view model (I’m not an advocate of this approach, personally, but it’s the closest to what you’re looking to do).

    If you’re set on the approach that you’re taking here, however, keep in mind that you do have it named in that control, so you can re-expose it as a static property on the control in question:

    class MyControlWithTipIcon
    {
        public static TaskbarIcon TaskBarIcon { get { return MyNotifyIcon; } }
    
    }
    

    Now, you can access it from your helper class:

    public static void DisplayMessageArea(string messageToDisplay)
    {
        MyControlWithTipIcon.TaskBarIcon.ToolTipText = messageToDisplay;
        MyControlWithTipIcon.TaskBarIcon.Visibility = ... //i.e. show the message
    }
    

    I would not personally advocate that approach at all, but it is probably the easiest way to do, specifically, what you’re asking. If you go this route, however, remember to check the TaskBarIcon static property for null before doing anything with it, and keep in mind that the static property will work return a value whether or not your control containing it has been loaded or even instantiated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF, ClickOnce application that I am trying to build using the
I have a static, typed dataset that I am using within my WPF application
I have a WPF Application using Fluent NHibernate 1.0 RTM and System.Data.SQLite 1.0.65 that
I have a WPF application using MVVM. I have some user controls that show
Basically I have a WPF application that will display announcements to the user within
I have a multithreaded WPF application that is using > 600 threads after is
I'm writing WPF application, that's using MVVMLight. I have a DataGrid and I wanna
I have a WPF/C# application that is using the MVVM light framework. When it
I have a WPF application that I want to launch using: Assembly.LoadFrom It works
I have built a wpf application that is using EF and SQLCE4. Everything works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.