I have a xamDataGrid that is bound to a custom IBindingList.
I do something that causes the data to change outside of the context of the Grid (I change my units of measure from Metric to Imperial). When I do this, I force the grid to refetch the data by reseting the binding
IEnumerable temp = this.ResultSetDataGrid.DataSource;
this.ResultSetDataGrid.DataSource = null;
this.ResultSetDataGrid.DataSource = temp;
This works fine except that it doesn't refresh the column header. Does anyone know how to force the header to refresh its values?
Thanks.
I don't know that there are any samples using custom IBindingLists but basically that is how the binding to something like the DataTable works and how the DataPresenter finds out when a column is added/removed. It is possible there is a bug so the best case may be to submit the issue to the support group so we can look into the matter.
Actually that was one of the first things I tried.
When I fire the ListChanged event on my collection nothing seems to happen. The grid doesn't seem to refetch any data. Is there anything I need to do to get this working?
SupportsChangeNotification = true
Was the only thing that I could see. Am I missing something?
Are there any samples involving an IBindingList and the xaml grid that I could use to double check I have everything setup right?
When the metadata for the properties has been changed, one would normally raise the ListChanged event of the IBindingList with the appropriate change type - e.g. PropertyDescriptorChanged.
I am not sure how to "refresh" it, but one option is to clear the FieldLayouts and add a new one, You can define it in the Xaml and just get it as a resource.
Alex.
Since the value for my column header comes from my IBindingList, I think what I want to do is refresh the FieldLayouts Collection rather than create a new one.
Is there and easy way to force this referesh?
I browsed through Field and FieldLayouts but I didn't see anything obvious.