title: How to bind a table in a dataset to a WPF datagrid in C# and XAML
body: <p>I have been searching to hours for something very simple: bind a WPF datagrid to a datatable in order to see the columns at design-time. I can’t get any of the examples to work for me.</p>
  
  <p>Here is the C# code to populate the datatable InfoWork inside the dataset info:</p>
  
  <pre><code>info = new Info();
  InfoTableAdapters.InfoWorkTableAdapter adapter = new InfoTableAdapters.InfoWorkTableAdapter();
  adapter.Fill(info.InfoWork);
  </code></pre>
  
  <p>The problem is no matter how I declare ‘info’ or ‘infoWork’ Visual Studio/XAML can’t find it. I have tried:</p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;ObjectDataProvider x:Key="infoWork" ObjectType="{x:Type local:info}"  /&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  
  <p>I have also tried this example from wpf.codeplex, but XAML doesn’t even like the “local:” keyword!</p>
  
  <pre><code>&lt;Window.Resources&gt;
     &lt;local:info x:Key="infoWork"/&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  
  <p>There are really two main questions here:
  1)  How do I declare the table InfoWork in C# so that XAML can see it? I tried declaring it Public in the window class that XAML exists in with no success.
  2)  How do I declare the windows resource in XAML, specifcally the datatable inside the dataset?</p>
  
  <p>Out of curiosity, is there a reason that ItemsSource just doesn't show up as a property that be set in the properties design window?</p>