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

  • Home
  • SEARCH
  • 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 8298887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:56:46+00:00 2026-06-08T15:56:46+00:00

So, I created a Singleton to be used to track a ToolTip enabler that

  • 0

So, I created a Singleton to be used to track a ToolTip enabler that is used globally throughout the entire application, but when I try to bind it to a ToolTip, it binds the value initially, but then when I change the ToolTip enabler value, the binding does not update.

This is the User Control that creates the bind to the ToolTip:

 public partial class ViewTreeClass : UserControl {
      private void addStuff() {
           EnvironmentalVariables.Instance.ToolTipEnable = true;
           Binding bind = new Binding() {
                Source = EnvironmentalVariables.Instance.ToolTipEnable,
           };
           ToolTip x = new ToolTip();
           x.Content = "This is text";
           user.SetBinding(ToolTipService.IsEnabledProperty, bind);
           user.ToolTip = x;
           EnvironmentalVariables.Instance.ToolTipEnable = false;
           // Executing the above statement changes the variable, but ToolTipService.IsEnabledProperty does not change to reflect EnvironmentalVariables.Instance.ToolTipEnable
      }
 }

This is the Singleton that implements INotifyPropertyChanged:

 public class EnvironmentalVariables : INotifyPropertyChanged {
      private static EnvironmentalVariables instance = new EnvironmentalVariables();
      public static EnvironmentalVariables Instance {
           get {
                if(instance == null) {
                     instance = new EnvironmentalVariables();
                }
                return instance;
           }
      }

      private EnvironmentalVariables() { }

      private bool tooltipEnable;
      public bool ToolTipEnable {
           get {
                return tooltipEnable;
           }
           set {
                if(tooltipEnable != value) {
                     tooltipEnable = value;
                     this.RaiseNotifyPropertyChanged("ToolTipEnable");
                }
           }
      }

      private void RaiseNotifyPropertyChanged(string property) {
           if(PropertyChanged != null) {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
           }
      }

      public event PropertyChangedEventHandler PropertyChanged;
 }

When I change ‘EnvironmentalVariables.Instance.ToolTipEnable = false;’ it changes the Singleton variable to ‘false’, but it doesn’t update ToolTipService.EnabledProperty to ‘false’ and PropertyChanged is always null. Am I missing a subscription to PropertyChanged somewhere?

The Singleton and the UC are both in different namespaces/class files.

  • 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-06-08T15:56:47+00:00Added an answer on June 8, 2026 at 3:56 pm

    Problem is in the first extract IMO, the way you create the binding. What type is user ?

    Set Instance as the Source, and ToolTipEnable as the Path (bind.Path = new PropertyPath("ToolTipEnable")).

    And have you a reason for using ToolTipService.IsEnabledProperty instead of ToolTip.IsEnabledProperty ? I’m not sure this is the good place for this trick (but I may be wrong, try both ^^).

    Your singleton is wrong (but not causing the problem). I’ve corrected the way you raise your event too :

     public sealed class EnvironmentalVariables : INotifyPropertyChanged {
          private static readonly EnvironmentalVariables instance = new EnvironmentalVariables();
          public static EnvironmentalVariables Instance {
               get 
               {
                   return instance;
               }
          }
    
          private EnvironmentalVariables() { }
    
          private bool tooltipEnable;
          public bool ToolTipEnable {
               get {
                    return tooltipEnable;
               }
               set {
                    if(tooltipEnable != value) {
                         tooltipEnable = value;
                         this.RaiseNotifyPropertyChanged("ToolTipEnable");
                    }
               }
          }
    
          private void RaiseNotifyPropertyChanged(string property) {
               var handler = PropertyChanged;
               if(handler != null) {
                    handler (this, new PropertyChangedEventArgs(property));
               }
          }
    
          public event PropertyChangedEventHandler PropertyChanged;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java singleton class that has my application settings. I used this
I've created a singleton class that loads a plist. I keep getting this error
I have created a singleton class to keep track of my data on my
I am trying to access the singleton instance created by my WCF service but
I am attempting to create a singleton service that is used to process incoming
i used to create an instance of a singleton class like this: $Singleton =
I've created a singleton class which uses GetInstance() method to get the instance address
I've created a custom library using singleton pattern. Why by this way? because I
I've created a system where i can request an NSManagedObjectContext from a singleton object,
Actually i have created an singleton class. Now my singleton class extends Activity, and

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.