i want to add a new row in data grid of WPF with specific data each time I click a button, where rows will be one after another.However my code is just replacing the previous on not adding a new one below it: here is my code behind:
ObservableCollection<DataItem> items = new ObservableCollection<DataItem>();
items.Add(new DataItem() { Product = product, Quantity = qnt.ToString(), Price = price, Total = totalPrice.ToString() });
dataGrid.ItemsSource = items;
"dataGrid" is the name in the XAML. Can anyone help!