title: PropertyChangedEventHandler is both times null, but the binding works only once, why?
body: <p>I made a little Project to learn a bit about MVVM. It is a calculator that calculates when you are allowed to go home from work.</p>
  
  <p>I made a <code>UserControl</code> with two Textboxes and a single label as a simple "TimePicker". This Usercontrol has a ViewModel (the Mainwindow even has one) which manages the time of one Timepicker. It has three Properties: an int called <code>TimeValue</code> which is just the value of hours and minutes and two ints called <code>Hours</code> and <code>Minutes</code>. My two Textboxes are bound to them and display them. Setting one value via Textbox also resets Time, setting time (via Property) resets Hours and Minutes, both textboxes are updated after setting this value.</p>
  
  <p>This works quit fine. Now I wanted to add a second Property called <code>ReadOnly</code>. ReadOnly is needed for the TimePicker which displayes the time to go. It makes no sense to manually set this time so I want to have a possibility to set both Textboxes <code>IsReadOnly</code> Property. </p>
  
  <p><code>ReadOnly</code> is now a second Property of the UserControl. Because I am lazy I wanted to directly bind the Property and both Textboxes via the UserControl and bind only the <code>IsReadOnly</code>-Property to the UserControl.</p>
  
  <p>This was the Code of my Idea (Usercontrol):</p>
  
  <pre><code>public partial class TimeBox : UserControl, INotifyPropertyChanged
  {
      private SingleTimeViewModel viewModel;
  
      //... other Properties
  
      public static DependencyProperty ReadOnlyProperty = DependencyProperty.Register("ReadOnly", typeof(Boolean), typeof(TimeBox), new PropertyMetadata(false));
  
      // Schnittstellen-Ereignis  
      public event PropertyChangedEventHandler PropertyChanged;
      protected internal void OnPropertyChanged(string propertyname)
      {
          if (PropertyChanged != null)
              PropertyChanged(this, new PropertyChangedEventArgs(propertyname));
      }
  
      public TimeBox()
      {
          InitializeComponent();
          viewModel = new SingleTimeViewModel(SingleTime.CreateSingleTime());
          this.DataContext = viewModel;
      }
  
      //... Code of other Properties
  
      private bool _ReadOnly;
      public bool ReadOnly
      {
          get
          {
              return _ReadOnly;
          }
          set
          {
              if (_ReadOnly == value)
                  return;
              _ReadOnly = value;
              OnPropertyChanged("ReadOnly");
          }
      }
  
      //... Other Methods
  }
  </code></pre>
  
  <p>This was bound to both Textboxes via XAML (Bindings for <code>Text</code> lead to ViewModel, IsReadOnly should bind to TimeBox):</p>
  
  <pre><code>&lt;UserControl x:Name="TimeBoxControl" x:Class="TimeCalculator.TimeBox"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           ... &gt;
      &lt;WrapPanel Grid.Column="7" HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="1" VerticalAlignment="Center" &gt;
          &lt;TextBox x:Name="txtBxHours" ... Text="{Binding Hours}" ... IsReadOnly="{Binding ReadOnly, ElementName=TimeBoxControl}" /&gt;
          &lt;Label x:Name="lblSeparator" ... /&gt;
          &lt;TextBox x:Name="txtBxMinutes" ... Text="{Binding Minutes}" ...  IsReadOnly="{Binding ReadOnly, ElementName=TimeBoxControl}" /&gt;
     &lt;/WrapPanel&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>I made the values readonly at the Constructor of the Mainwindow of my Project after <code>InitializeComponent</code>. Therefore I used the following lines:</p>
  
  <pre><code>this.TmBxMayGo.ReadOnly = true;
  this.TmBxMustGo.ReadOnly = true;
  this.TmBxTimeUntilMayGo.ReadOnly = true;
  this.TmBxTimeUntilMustGo.ReadOnly = true;
  this.TmBxCurrentOvertime.ReadOnly = true;
  </code></pre>
  
  <p>This did not work, after some debugging I found out it did not because <code>PropertyChangedEventHandler PropertyChanged</code> was always <code>null</code>.
  I searched a lot to find a solution for this problem, but I made none of the common mistakes (e. g. forgot <code>: INotifyPropertyChanged</code>, wrong names in Strings or else).</p>
  
  <p>I finally gave up and made it via ViewModel. But then I realised that <code>PropertyChangedEventHandler PropertyChanged</code> was also <code>null</code> when I set it via ViewModel, but the textboxes were ReadOnly after calling.</p>
  
  <p>Now the two questions I have:</p>
  
  <ol>
  <li>Does it make sense to make an own ViewModel for an single Usercontrol?</li>
  <li>Why is that so? How can it be that <code>PropertyChanged</code> is <code>null</code> twice but only works once?</li>
  </ol>