title: WPF DataGrid Row add in codebehind
body: <p>I am from VB.Net WinForms comming. Now I wanted to write a small app in WPF, listing some files in a datagridview. I used WPF's DataGrid, created some Columns. And then failed to add my rows. </p>
  
  <p>Please, can you help me to select the right way to get my filenames, state-text and thumbnails added to the DataGrid Row?</p>
  
  <p>In VB.Net WinForms I can add a row like this:</p>
  
  <pre><code>Datagridview1.Rows.add(Myvalue, "RowStateText", "Hello World", MyDate)
  </code></pre>
  
  <p>In WPF's DataGrid I can add</p>
  
  <pre><code>DataGrid1.Items.Add(New DataGridRow())
  </code></pre>
  
  <p>But how to fill my DataGridRow?</p>
  
  <pre><code>  Private Sub AddFilesAndFolders(ByVal Base As IO.DirectoryInfo, ByRef dgv As DataGrid)
          'For Each di As IO.DirectoryInfo In Base.GetDirectories
          '    Call AddFilesAndFolders(di, dgv)
          'Next
  
          Dim item As DataGridRow
  
  
  
          For Each fi As IO.FileInfo In Base.GetFiles
              item = New DataGridRow'&lt;-- test 1 (row is added but empty)
              Dim di As New MyFileInfo'&lt;-- test 2 (my own class with public members, but how to add as row with declared columns?)
              di.FileName = fi.FullName
              di.FileDate = fi.LastAccessTime
  
              item.Item = fi.FullName
              dgv.Items.Add(di)
          Next
      End Sub
  </code></pre>