I am new to WPF please help me in solving below issue.
Below is my xaml code
How to refresh DataGrid on source change?
Kindly help.
Thanks,
Krishna.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
krishna chaitanyaPosted Apr 27, 2015, 5:01 AM
thank you so much for your response. sorry i have missed xaml code:
see below, binding XML data like below not writing any list or data table in code behind. This case how to refresh data grid?
Tom MohanPosted Apr 27, 2015, 4:51 AM
For this you need to declare the ItemsSource property as dependency property or you need to implement INotifyproperty. Go ahead with INotifypropery that is light weight. Refer the below article
http://www.c-sharpcorner.com/UploadFile/91c28d/implement-change-notification-using-inotifypropertychanged-i/
dinesh kumarPosted Apr 27, 2015, 3:22 AM
yourdatagrid.Items.Refresh() you can also reset the itemsource when you add the new data into xml file.
yourdatagrid.ItemsSource = null;
Yourdatagrid.ItemsSource = yourSource;
Yourdatagrid.Items.Refresh();
this should work.
if you this solution to be helpful please upvote it.
Regard,
DK.