Clear datagrid values in wpf

后端 未结 7 1461
粉色の甜心
粉色の甜心 2021-01-11 19:14

I need to flush my datagrid everytime when a treeviewitem is clicked. My code is given below.

private void treeView1_SelectedItemCh         


        
7条回答
  •  悲哀的现实
    2021-01-11 20:02

    You have to unbind the itemsource before you clear the item

    MyGrid.ItemsSource = null;**//un-bind the itemsource first**
    MyGrid.Items.Clear();**//**
    

提交回复
热议问题