title: How can i write a datagrid to a textfile in WPF?
body: <p>How can i write all my values in my datagrid not datagridview in a textfile i have the following code but it only saves the last values and not every value in the datagrid </p>
  
  <p>my code</p>
  
  <pre><code>string file_name = "text.txt";
  
  for (int i = 0; i &lt; datagrid.Items.Count; i++)
  { 
      //this is the class person
      Person prsn = (Person)datagrid.Items[i];
      File.WriteAllText(file_name, person.ToString());
  }
  </code></pre>
  
  <p>How can i fix this?</p>