title: I can't get my value to update using INotifyPropertyChanged
body: <p>So I am learning WPF by making a yatzee game, and I'm getting somewhere. But now I can not understand why I my "current roll" counter won't update in the View. I made the Dices work, and the roll dices button gives my dices new values - and this is updated in the view. But my "Current roll" variable will not. This is what I've done so far.</p>
  
  <pre><code>// CurrentRoll.cs
      public class CurrentRoll : INotifyPropertyChanged
  {
      public int _roll;
  
      public int Roll
      {
          get { return _roll; }
          set
          {
              if (value != _roll)
              { 
              _roll = value;
              OnPropertyChanged("Roll");
              }
          }
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      protected void OnPropertyChanged(string name)
      {
          PropertyChangedEventHandler handler = PropertyChanged;
          if (handler != null)
          {
              handler(this, new PropertyChangedEventArgs(name));
          }
      }
  }
  </code></pre>
  
  <p>Then this is my DiceModelView. When I hit my "Roll Dices" button I get new values on all my dices as long as they are left unchecked. I also increment the _currentRoll variable, and only allow new rolls as long as _currentRoll still is less than 3. This logic works, the variable works, but it's representation in the View does not. I've also changed its initial value to other values just to see that my binding works, and it does.</p>
  
  <pre><code>public class DiceModelView : INotifyPropertyChanged
  {
      Die _die;
      public CurrentRoll _currentRoll;
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      public ObservableCollection&lt;Die&gt; myDices { get; set; }
      public ICommand RollCommand { get; set; }
  
      public DiceModelView()
      {
          myDices = new ObservableCollection&lt;Die&gt;()
          {
              new Die { Id = 0, Roll = 0, Checked = false },
              new Die { Id = 1, Roll = 0, Checked = false },
              new Die { Id = 2, Roll = 0, Checked = false },
              new Die { Id = 3, Roll = 0, Checked = false },
              new Die { Id = 4, Roll = 0, Checked = false }
          };
          _currentRoll = new CurrentRoll();
          _currentRoll._roll = 0;
          RollCommand = new Command (executeMethod, canexecuteMethod);
      }
  
      public bool canexecuteMethod(object parameter)
      {
          return true;
      }
  
      private void executeMethod(object parameter)
      {
          var r = new Random();
          if (_currentRoll._roll &lt; 3)
          {
              foreach (Die d in myDices)
              {
                  if (d.Checked == false)
                  {
                      d.Roll = r.Next(1, 7);
                  }
              }
          }
          _currentRoll._roll++;
      }
  
      private void NotifyPropertyChanged(String propertyName = "")
      {
          if (PropertyChanged != null)
          {
              PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
          }
      }
  
      public Die die
      {
          get { return _die; }
          set { _die = value; }
      }
  
      public CurrentRoll currentRoll
      {
          get { return _currentRoll; }
          set { _currentRoll = value;
              NotifyPropertyChanged("currentRoll");
          }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/2yzCI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2yzCI.png" alt="How my application is now, in this example I set _currentRoll._roll to 111 just to be sure that it works. I&#39;ve not rolled any dices as the aforementioned value is more than 3."></a></p>
  
  <p>Finally, this is the XAML code I use:</p>
  
  <pre><code>&lt;Window.DataContext&gt;
      &lt;local:DiceModelView/&gt;
  &lt;/Window.DataContext&gt;
  &lt;StackPanel&gt;
      &lt;TextBlock Text="{Binding currentRoll.Roll, UpdateSourceTrigger=PropertyChanged}"/&gt;
      &lt;ListView x:Name="DiceView" ItemsSource="{Binding myDices}" Width="500" HorizontalContentAlignment="Center" &gt;
          &lt;ListView.ItemTemplate&gt;
              &lt;DataTemplate &gt;
                  &lt;CheckBox Content="{Binding Roll}" IsChecked="{Binding Checked}"/&gt;
              &lt;/DataTemplate&gt;
          &lt;/ListView.ItemTemplate&gt;
      &lt;/ListView&gt;
      &lt;Button Content="Roll the dices!" Command="{Binding RollCommand}"/&gt;
  &lt;/StackPanel&gt;
  &lt;/Window&gt;
  </code></pre>