title: Binding button IsEnabled to a property
body: <p>I have a class which has implemented <code>INotifyPropertyChanged</code>. This class <code>UserInfo</code> has a boolean variable isuserLoggedIn.
  Now in my mainform I have buttons whose isEnabled I wish to bind to <code>UserInfo.isuserLoggedIn</code>.</p>
  
  <p>How to do that?</p>
  
  <pre><code>    public  class UserInfo : INotifyPropertyChanged
      {
          private static readonly UserInfo _instance = new UserInfo();
          private string username; 
  
          private  bool isLoggedIn;
  
          public string UserName
          {
              get { return username; }
              set
              {
                  username = value;
                  NotifyPropertyChanged("UserName");
              }
          }
  
          public  bool UserLoggedIn
          {
              get { return isLoggedIn; }
              set
              {
                  isLoggedIn = value;
                  NotifyPropertyChanged("UserLoggedIn");
              }
          }
  
  
          public  event PropertyChangedEventHandler PropertyChanged;
  
          public void NotifyPropertyChanged(string propertyName)
          {
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
              }
          }               
  
      public static UserInfo GetUserInfo()
      {
          return _instance;
      }
  
  }
  </code></pre>
  
  <p>In the main I have:</p>
  
  <pre><code>public class MainWindow
  {
      UserInfo currentUser = UserInfo.GetUserInfo();
  }
  </code></pre>
  
  <p>The XAML is:</p>
  
  <pre><code>&lt;Button IsEnabled="{Binding ElementName=currentUser, Path=UserLoggedIn}"/&gt;
  </code></pre>