title: How can I add row to datagrid in wpf?
body: <p>I am very new to wpf. I am looking for some equivalent for:</p>
  
  <pre><code>dataGridView1.Rows.Add(sNazwa, 1, opakowanie, cena, sWartoscNetto, sVAT, sWartoscBrutto);
  </code></pre>
  
  <p>I know that I should use </p>
  
  <pre><code>mainwindow.dataGrid1.Items.Add()
  </code></pre>
  
  <p>but how can I define a row I want to add here?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I think I should elaborate a bit on what I plan to achieve.
  I am rewriting a program I made in WinForms. It makes offers for clients. It has a gridview in winforms that has a list of products for my client. In secon window I have a gridform connected to sql database. By double click on a row, some of data from the row should be transfered to mainwindow datagrid (but not the whole row). In mainwindow datagrid user should be able to edit cells, move rows (up and down), sort and delete rows. Will List&lt;> let me do all this things? I tried to use your solution to add a row using List and it works (but I struggle to send data from second window), but still I wonder if it will let me do al this things I want later on.</p>
  
  <p><strong>EDIT</strong>
  This works:</p>
  
  <pre><code>public class Produkt
  {
    public string Nazwa { get; set;}
    public string Opakowanie { get; set; }
    public string Ilosc { get; set; }
    public string Cena { get; set; }
    public string WartoscNetto { get; set; }
    public string VAT { get; set; }
    public string WartoscBrutto { get; set; }
  }
  
  public List&lt;Produkt&gt; DodajProdukty()
  {
    List&lt;Produkt&gt; produkt = new List&lt;Produkt&gt;();
    produkt.Add(new Produkt() { Nazwa = "test", Opakowanie = "test", Ilosc = "1", Cena = "test", WartoscNetto = "test", WartoscBrutto = "test" });
    return produkt;
  
  }
  
  
  private void Window_Loaded(object sender, RoutedEventArgs e)
  {
    dataGrid1.ItemsSource = DodajProdukty();
  }
  </code></pre>
  
  <p>but how can I add a row from different window?</p>
  
  <p>thanks,</p>