I need to flush my datagrid everytime when a treeviewitem is clicked. My code is given below.
datagrid
treeviewitem
private void treeView1_SelectedItemCh
You have to unbind the itemsource before you clear the item
MyGrid.ItemsSource = null;**//un-bind the itemsource first** MyGrid.Items.Clear();**//**