title: Automatic field update in WPF XAML binding - simple example not working
body: <p>I'm very new in C#, WPF, XAML and Binding, and to learn this nice environment, I created this little exercise myself: I want to show a price including VAT and excluding VAT. But I want to have the other field be updated automatically as soon as I change a field (so as soon as I hit Tab).
  I have already created a class (thanks to help in another question I posted in Stack Overflow) to do the math. But my issue us now that the fields don't get updated. I use the INotifyPropertyChange Interface, but for some reason, it just doesn't work.
  Here's what is happening:</p>
  <p><a href="https://i.stack.imgur.com/k7F1f.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k7F1f.gif" alt="VAT example" /></a></p>
  <p>I use the following XAML code:</p>
  <pre><code>&lt;Window x:Class=&quot;BTWv2.MainWindow&quot;
          xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
          xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
          xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
          xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
          xmlns:local=&quot;clr-namespace:BTWv2&quot;
          mc:Ignorable=&quot;d&quot;
          Title=&quot;MainWindow&quot; Height=&quot;150&quot; Width=&quot;250&quot;&gt;
      &lt;Grid&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width=&quot;20&quot; /&gt;
              &lt;ColumnDefinition Width=&quot;auto&quot; /&gt;
              &lt;ColumnDefinition Width=&quot;auto&quot; /&gt;
              &lt;ColumnDefinition Width=&quot;auto&quot; /&gt;
              &lt;ColumnDefinition Width=&quot;*&quot; /&gt;
              &lt;ColumnDefinition Width=&quot;20&quot; /&gt;
  
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height=&quot;20&quot;/&gt;
              &lt;RowDefinition Height=&quot;auto&quot;/&gt;
              &lt;RowDefinition Height=&quot;auto&quot;/&gt;
              &lt;RowDefinition Height=&quot;auto&quot;/&gt;
              &lt;RowDefinition Height=&quot;20&quot;/&gt;
  
          &lt;/Grid.RowDefinitions&gt;
  
          &lt;Label Grid.Column=&quot;1&quot; Grid.Row=&quot;1&quot; Content=&quot;Amount inc VAT:&quot; VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot;/&gt;
          &lt;TextBox 
                   Grid.Column=&quot;2&quot; Grid.Row=&quot;1&quot; 
                   VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot; 
                   Width=&quot;100&quot; Text=&quot;{Binding IncludeVat,Mode=TwoWay}&quot;/&gt;
  
          &lt;Label Grid.Column=&quot;1&quot; Grid.Row=&quot;3&quot; Content=&quot;Amount excl VAT:&quot; VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot;/&gt;
  
          &lt;TextBox Text=&quot;{Binding ExcludeVat,Mode=TwoWay}&quot;
                 Grid.Column=&quot;2&quot; Grid.Row=&quot;3&quot; 
                 VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot; 
                 MinWidth=&quot;100&quot;
                 /&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  <p>And here is the actual C# code (I'm using a class named CalculateVAT for the calculation of the numbers:</p>
  <pre><code>using System;
  using System.ComponentModel;
  using System.Runtime.CompilerServices;
  using System.Windows;
  namespace BTWv2
  {
      public partial class MainWindow : Window
      {
          public MainWindow()
          {
              InitializeComponent();
  
              CalculateVAT Price = new CalculateVAT();
              Price.IncludeVat = 100;
              DataContext = Price;
  
          }
  
          public class CalculateVAT : INotifyPropertyChanged
          {
              private decimal m_IncludeVat; // &lt;- decimal is a better choice for finance
  
              // To compute VAT we should know the percent; let it be known
              public const decimal Percent = 21.0m;
  
  
              public decimal IncludeVat
              {
                  get =&gt; m_IncludeVat;
                  set
                  {
                      // negative cash are usually invalid; if it's not the case, drop this check
                      if (value &lt; 0)
                          throw new ArgumentOutOfRangeException(nameof(value));
                      m_IncludeVat = value;
                      Tax = Math.Round(m_IncludeVat / 100 * Percent, 2);
                      NotifyPropertyChanged();
                  }
              }
  
              public decimal ExcludeVat
              {
                  get =&gt; m_IncludeVat - Tax;
                  set
                  {
                      if (value &lt; 0)
                          throw new ArgumentOutOfRangeException(nameof(value));
                      m_IncludeVat = Math.Round(value / 100 * (100 + Percent), 2);
                      Tax = m_IncludeVat - value;
                      NotifyPropertyChanged();
                  }
              }
  
              // Let's be nice and provide Tax value as well as IncludeVat, ExcludeVat 
              public decimal Tax { get; private set; }
  
              public override string ToString() =&gt;
                $&quot;Include: {IncludeVat:f2}; exclude: {ExcludeVat:f2} (tax: {Tax:f2})&quot;;
  
  
  
              public event PropertyChangedEventHandler? PropertyChanged;
  
              private void NotifyPropertyChanged([CallerMemberName] String propertyName = &quot;&quot;)
              {
                  PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
              }
          }
  
      }
  }
  </code></pre>
  <p>Has anyone an idea what I'm missing here?
  I already tried the UpdateSourceTrigger=PropertyChanged setting in the binding, but that doesn't seem to change anything..</p>