title: How to bind a simple .net property to a label and have it auto update
body: <p>I'm kinda new to data binding and obviously don't really understand it.  I'm trying to bind a simple .net property to a label, and have that label updated whenever the property is changed.  It's not working and i'm not sure where the problem lies.</p>
  
  <p>Here is my XAML</p>
  
  <pre><code> &lt;Label Content="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/Label&gt;
  
   &lt;Button Name="bChangeProperty" Click="bChangeProperty_Click"&gt;Change Property&lt;/Button&gt;
  </code></pre>
  
  <p>Here is my UserControl cs file</p>
  
  <pre><code>public partial class MyUserControl : UserControl, INotifyPropertyChanged
  {
  
     private MyObjectClass _myObject;
     public MyObjectClass MyProperty
     {
         get { return _myObject;}
         set
         {
            if (_myObject != value)
            {
                _myObject = value;
                OnPropertyChanged("MyProperty"); 
            }
          }
     }
  
  
     public MyUserControl(MyObjectClass obj)
     {
        if (obj == null)
        {
            obj = new MyObjectClass();
            obj.Name = "Frank";
        }
        MyProperty= obj;
        base.DataContext = MyProperty;
     }
  
     //INotifyPropertyChanged stuff
     public event PropertyChangedEventHandler PropertyChanged;
     private void OnPropertyChanged(string propertyName)
     {
        //PropertyChanged is always null, don't really understand this part
        if (PropertyChanged != null)
           PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     }
  
  
     private void bChangeProperty_Click(object sender, RoutedEventArgs e)
     {
         //Create a new object, and set it to the MyProperty Property - which I thought
         //would update the label, but it doesn't
         MyObjectClass newObject = new MyObjectClass();
         newObject.Name = "Bob";
  
         MyProperty= newObject;
     }
  </code></pre>
  
  <p>Here is the MyObjectClass</p>
  
  <pre><code>public class MyObjectClass
  {
      public string Name {get; set;}
  }
  </code></pre>
  
  <p>The inital bind works, it will set the Label to "Frank", but when I click the button and the object is changed, the label won't update.  This is just an example of something "like" what i'm trying to do. </p>
  
  <p>Do I have to set PropertyChanged to something somewhere?  I kinda thought thats what the XAML was suppose to do, but seeing how it is always null, apparently it's not. </p>