title: DataGrid TSV file with dynamic columns
body: <p>I am trying to create a DataGrid in WPF, in order to make an editor for some tab separated files. The first line of the TSV contains the columns. Also after some research, I found this code 
  <a href="https://stackoverflow.com/questions/26753914/import-data-from-text-file-and-display-in-datagrid">Import data from text file and display in datagrid</a>
  which works pretty good, but, when the file is loaded the window becomes unresponsive. Or when I try to resize the window (or scroll down) again the same, it takes time to load it
  This is from MainWindow.xaml</p>
  
  <pre><code> &lt;DataGrid x:Name="dtGrid" Grid.Row="1" AutoGenerateColumns="True" ItemsSource="{Binding}"/&gt;
  </code></pre>
  
  <p>Mainwindow.cs</p>
  
  <pre><code>dtGrid.DataContext = Helper.DataTableFromTextFile("tsv.txt", '\t');
  </code></pre>
  
  <p>PS. I also tried this too.</p>
  
  <pre><code>dtGrid.ItemsSource = Helper.DataTableFromTextFile("tsv.txt", '\t').DefaultView;
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT:</p>
  
  <pre><code>&lt;Window x:Class="MyFileEdit.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:MyFileEdit"
          mc:Ignorable="d"
          Title="File Edit" Height="350" Width="525" Loaded="Window_Loaded"&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="16*" MinHeight="16" MaxHeight="16"/&gt;
              &lt;RowDefinition Height="303*"/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;DataGrid x:Name="dtGrid" Grid.Row="1" AutoGenerateColumns="True" ItemsSource="{Binding}"/&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>