title: Bind JSON to XAML-WPF
body: <p>I have a Json and I want to bind some values from the json in a wpf form. Some values should be passed in a simple text box but some others I need to bind them in an adjustable table depending on the json. 
  My Xaml code is this:</p>
  
  <pre><code>&lt;Window x:Class="WpfApp.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:WpfAppTest1"
      mc:Ignorable="d"
      Title="MainWindow" Height="750" Width="525"&gt;
  &lt;Grid Name="Grid1"&gt;
      &lt;Button x:Name="buttonPrint" Click="print_Click" Content="Print" HorizontalAlignment="Left" Margin="340,621,0,0" VerticalAlignment="Top" Width="115" Height="30"/&gt;
      &lt;Label x:Name="number" Content="Number" HorizontalAlignment="Left" Margin="45,20,0,0" VerticalAlignment="Top" Width="68"/&gt;
      &lt;Grid x:Name="nameCol" Height="260" Margin="45,240,382,0" VerticalAlignment="Top"/&gt;
      &lt;Label x:Name="name" Content="Name" HorizontalAlignment="Left" Margin="53,255,0,0" VerticalAlignment="Top" Width="60"/&gt;
      &lt;Grid x:Name="phoneCol" Height="260" Margin="145,240,282,0" VerticalAlignment="Top"/&gt;
      &lt;Label x:Name="phone" Content="Phone" HorizontalAlignment="Left" Margin="175,255,0,0" VerticalAlignment="Top" Width="60"/&gt;
      &lt;Grid x:Name="addressCol" Height="260" Margin="235,240,192,0" VerticalAlignment="Top"/&gt;
      &lt;Label x:Name="address" Content="Address" HorizontalAlignment="Left" Margin="265,255,0,0" VerticalAlignment="Top" Width="80"/&gt;
      &lt;Grid x:Name="emailCol" Height="260" Margin="365,240,62,0" VerticalAlignment="Top"/&gt;
      &lt;Label x:Name="email" Content="Email" HorizontalAlignment="Left" Margin="365,255,0,0" VerticalAlignment="Top" Width="60"/&gt;
      &lt;Grid Name="table" HorizontalAlignment="Left" Height="288" Margin="40,242,0,0" VerticalAlignment="Top" Width="430"/&gt;
      &lt;TextBox x:Name="number" HorizontalAlignment="Left" Height="23" Margin="118,20,0,0" TextWrapping="Wrap" Text="{Binding number}" VerticalAlignment="Top" Width="85" TextChanged="textBox_TextChanged"/&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>I should have a Document Number which is in the beginning of the form and then a table which contains Name, Phone, Address and Email. I create four grids to use them as columns, but I don't know how many rows should I have because this will be depending by the json.</p>
  
  <p>An example json is this:</p>
  
  <pre><code>{
  "number": 123,
  "person": [{
          "phone": 864556,
          "name": "John D",
          "address": "N.Y",
          "email": "test@test.com"
      },
      {
          "phone": 19845,
          "name": "Mary S",
          "address": "N.Y",
          "email": "testmary@test.com"
      },
      {
          "phone": 34936,
          "name": "Alex N",
          "address": "Santiago",
          "email": "alex@test.com"
      },
      {
          "phone": 097478,
          "name": "Bill McK",
          "address": "London",
          "email": "test@example.com"
          }]
      }
  ]}
  </code></pre>
  
  <p>So I first want to take the value from the number and then create the table with these data in my wpf form.</p>
  
  <p>Has anyone any idea? I have found this <a href="https://stackoverflow.com/questions/20989311/deserializing-nested-json-c-sharp-and-bind-to-xaml-listbox">Deserializing nested JSON C# and Bind to XAML ListBox</a> but I wasn' t be able to make it work properly in my case.</p>
  
  <p>Until now I have done this. I am working on Visual Studio, so I have a MainWindow.xaml where is my XAML template and then in MainWindow.xaml.cs I have turn my json to C# and I have this </p>
  
  <pre><code>public class Rootobject
  {
    public int number { get; set; }
    public Person[] person { get; set; }
   }
  
  public class Person
  {
  public int phone { get; set; }
  public string name { get; set; }
  public string address { get; set; }
  public string email { get; set; }
  </code></pre>
  
  <p>}</p>
  
  <p>And also I have edit my Xaml like this for example</p>
  
  <pre><code>&lt;TextBox x:Name="number" HorizontalAlignment="Left" Height="23" Margin="118,20,0,0" TextWrapping="Wrap" Text="{Binding number}" VerticalAlignment="Top" Width="85"/&gt;
  </code></pre>
  
  <p>But when I start the application the textBox appears to be empty. Where should I upload the json with its values and should I do something different in my cs file?</p>