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 7663563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:05:07+00:00 2026-05-31T14:05:07+00:00

I had a variable which was not static and INotifyPropertyChanged implemented succesfully. Then I

  • 0

I had a variable which was not static and INotifyPropertyChanged implemented succesfully. Then I tried to make it global, so turned it a static variable. But this time, INotifyPropertyChanged does not work. Any solution?

  • 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-31T14:05:08+00:00Added an answer on May 31, 2026 at 2:05 pm

    INotifyPropertyChanged works on instance properties. One solution is to use a singleton pattern and keep INotifyPropertyChanged, the other is to use your own event to notify listeners.

    Singleton example

    public sealed class MyClass: INotifyPropertyChanged
    {
       private static readonly MyClass instance = new MyClass();
       private MyClass() {}
    
       public static MyClass Instance
       {
          get 
          {
             return instance; 
          }
       }
    
       // notifying property
       private string privMyProp;
       public string MyProp
       {
           get { return this.privMyProp; }
    
           set
           {
               if (value != this.privMyProp)
               {
                   this.privMyProp = value;
                   NotifyPropertyChanged("MyProp");
               }
           }
       }
    
    
       // INotifyPropertyChanged implementation
       public event PropertyChangedEventHandler PropertyChanged;
    
       private void NotifyPropertyChanged(String info)
       {
           var handler = PropertyChanged;
           if (handler != null)
           {
               handler(this, new PropertyChangedEventArgs(info));
           }
       }
    }
    

    EDIT: In WPF 4.5, they introduced property changed mechanic for static properties:

    You can use static properties as the source of a data binding. The
    data binding engine recognizes when the property’s value changes if a
    static event is raised. For example, if the class SomeClass defines a
    static property called MyProperty, SomeClass can define a static event
    that is raised when the value of MyProperty changes. The static event
    can use either of the following signatures.

    public static event EventHandler MyPropertyChanged;
    public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I originally had an array[1..1000] that was defined as a global variable. But now
I've recently moved to Java, but I've had some problems with variable aliasing. I've
Previously a class which I'm now rebuilding had a member variable $settings which was
Had a coworker ask me this, and in my brain befuddled state I didn't
Had a good search here but can't see anything that gets my mind in
I have a large makefile which builds several libraries, installs them, and then keeps
I am building a Facebook application which should not be viewable to anyone under
My understanding is any method which does not modify state of the constaining class
I have a HTML+CSS grid layout as in this screenshot , which is essentially
i was asked a few java interview questions which i had no idea how

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.