Refresh Datagrid in WPF
There is no such things for DataGrid.DataBinding() in Datagrid, WPF, the data grid should update itself if any items in the collection is changed. However, I found if the data source is edited by other windows, it won't refresh the data grid.
Well, you can use DataGrid.Items.Refresh(), but sometime, I got an exception about not allow editItem, something like that.
I found the best way is setting the item source to null and set item source to be bounded the collection again, like this:
Code
public void DisplayList(IList< ISchedule> lst) | |
{ | |
lstItems.ItemsSource = null; | |
lstItems.ItemsSource = lst; | |
//lstItems.Items.Refresh(); | |
} |
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 3587 feedbacks awaiting moderation...
Form is loading...