1
Answer

Datagrid ItemsSource update UI

Jack J

Jack J

14y
5k
1

Hi,

When I change source of ItemsSource property columns suddenly disappears. What i am doing wrong? I am using DataTable for ItemsSoruce. I want to add some more columns thats why i am changing ItemsSource. 

//pseudo code, initialize control

DataTable dt = new DataTable();

DataTable dt2 = new DataTable();

datagrid.ItemsSource = dt.DefaultView;  //auto-generates column headers, everything is OK 


// button click

datagird.ItemsSource = dt2.DefaultView; //columns disappear, UI not updated?


Pls, Help me!

regards

Jack :)

Answers (1)