title: WPF - class property as data trigger
body: <p>I'm having this code where I would like to update the image in my main window when the property in a usercontrol changes. But somehow I can't get the trigger working.</p>
  
  <p>Some of the XAML code</p>
  
  <pre><code>&lt;StatusBar MinHeight="10" MaxHeight="20" VerticalAlignment="Bottom" Grid.Row="2"&gt;
      &lt;Image x:Name="SomeNameHere"&gt;
          &lt;Image.Style&gt;
              &lt;Style&gt;
                  &lt;Style.Triggers&gt;
                      &lt;DataTrigger Binding="{Binding Path=pingable}" Value="false"&gt;
                          &lt;Setter Property="Image.Source" Value="Icons/MainWindow/StatusOffline_stop_32x.png"/&gt;
                      &lt;/DataTrigger&gt;
                      &lt;DataTrigger Binding="{Binding Path=pingable}" Value="true"&gt;
                          &lt;Setter Property="Image.Source" Value="Icons/MainWindow/StatusOK_32x.png"/&gt;
                      &lt;/DataTrigger&gt;
                  &lt;/Style.Triggers&gt;
              &lt;/Style&gt;
          &lt;/Image.Style&gt;
      &lt;/Image&gt;
  &lt;/StatusBar&gt;
  </code></pre>
  
  <p>The part where the property comes from</p>
  
  <pre><code>public bool pingable { get; set; }
  
  public MainWindow()
  {
      InitializeComponent();
      pingable = PingHost("some random IP");
  }
  
  public bool PingHost(string nameOrAddress)
  {
      pingable = false;
      Ping pinger = new Ping();
      try
      {
          PingReply reply = pinger.Send(nameOrAddress);
          pingable = reply.Status == IPStatus.Success;
      }
      catch (PingException)
      {
          // Discard PingExceptions and return false;
      }
      return pingable;
  }
  </code></pre>
  
  <p>I see the property during debugging in the XAML editor so it seemingly gets recognized and I also see the value would fit. But somehow the setter doesn't get executed.
  Someone an idea on this?</p>
  
  <p>Thanks and have a nice day!</p>