title: How to bind a public property to a WPF TextBox.Text property
body: <p>I've been struggling to bind a <code>TextBox.Text</code> to some object's public property but unfortunately I'm not quite there yet.</p>
  
  <p>The actual XAML looks like:</p>
  
  <pre><code>&lt;Window 
      &lt;!-- skipped --&gt; 
      xmlns:local="clr-namespace:Dotnet.Samples.Foobar"
      xmlns:system="clr-namespace:System;assembly=mscorlib"&gt;
  
      &lt;Window.Resources&gt;
          &lt;local:Foobar x:Key="foobar" Foo="Lorem" Bar="Ipsum"
      &lt;/Window.Resources&gt;
      &lt;!-- skipped --&gt;
  
          &lt;TextBox Text="{Binding Source={StaticResource foobar}, Path=Foo}"&gt;
          &lt;TextBox Text="{Binding Source={StaticResource foobar}, Path=Bar}"&gt;
          &lt;!-- skipped --&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>With the data provider object being as simple as:</p>
  
  <pre><code>public class Foobar
  {
      public string Foo { get; set; }
      public string Bar { get; set; }
  
      public Foobar()
      {
  
      }
  }
  </code></pre>
  
  <p>I guess I'm sort of confused with WPF's various binding options and I'm probably mixing them up so any advice will be definitely appreciated.</p>
  
  <p><strong>EDIT</strong> -- All bindings are working ok, the remaining challenge is notifying changes from the Model to the ViewModel (the other way around works). I've committed the 'broken' code to an alternative repo:
   <a href="http://nanotaboada.svn.beanstalkapp.com/dotnet/trunk/Dotnet.Samples.Rijndael/" rel="nofollow">http://nanotaboada.svn.beanstalkapp.com/dotnet/trunk/Dotnet.Samples.Rijndael/</a></p>
  
  <p>Feel free to checkout and I'd be very happy to hear about any feedback about this. Thanks much in advance </p>