Add/Update/Remove Item in DataGrid Programmatically

Jan 28, 2009 at 10:35 PM
How do you add, update, and remove items in a WPF Toolkit DataGrid control programmatically?  Meaning, the items will be changed via code and not by a user entering by typing data in datagrid.

I can add a list of items by the following:

DataGrid1.ItemsSource = lstItems

I need to add, update, and remove by individual items.

Thanks in advance.
Feb 5, 2009 at 3:32 AM
If you are bound to the ItemsSource you can just update your data source directly and the DataGrid should update.  If you are not bound you can update the DataGrid through DataGrid.Items.