title: MVVM DataBinding
body: <p>I've started an MVVM project and now I'm stucking with correct DataBinding.
  My project has:</p>
  
  <p>A UserControl whit a ViewModel as DataContext like:</p>
  
  <pre><code>public partial class TestUserControl: UserControl
  {
     public TestUserControl()
     {
         this.DataContext = new TestUserControlViewModel();
     }
  }
  </code></pre>
  
  <p>ViewModel code is (BaseViewModel class contains PropertyChangedEventHandler):</p>
  
  <pre><code>public class TestUserControlViewModel : BaseViewModel
  {
     public KrankenkasseControlViewModel()
     {}
  
     public IEnumerable&lt;DataItem&gt; GetAllData
     {
        get
        {
            IGetTheData src= new DataRepository();
            return src.GetData();
        }
     }
  }
  </code></pre>
  
  <p>IGetTheData is the interface to DataContext:</p>
  
  <pre><code>public interface IGetTheData
  {
     IEnumerable&lt;DataItem&gt; GetData();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and finally the DataRepository code:</p>
  
  <pre><code>public class DataRepository : IGetTheData
  {
     private TestProjectDataContext dax = new TestProjectDataContext();
  
     public IEnumerable&lt;DataItem&gt; GetData()
     {
         return (from d in this.dax.TestData
                 select new DataItem
                 {
                    ID = d.ID,
                    SomeOtherData = d.SomeOtherData
                 });
     }
  }
  </code></pre>
  
  <p>My UserControl has a few TextBoxes, but what's the best way to bind correctly?</p>
  
  <p>Thanks for your help, regards.</p>