Hi All,
I am using a xamDataGrid and displaying an observable collection inside it.
But if I say m_xamDataGrid.ClearValue(XamDataGrid.DataSourceProperty), it only clears out the rows. Column names remain as it is. I also want clear out column names.
Can someone let me know how I can do it? Basically I want to rebind the grid to another data source after clearing earlier binding.
Thanks,
Sumeet
Hello
ClearValue revert the value of the property to the default one. When you call xamDataGrid.ClearValue(XamDataGrid.DataSourceProperty..) this clears only the Data Source.
Instead of clearing first the DataSource and then the FieldLayouts, you can just set the DataSource to the new one and the layouts will be generated automatically.
Note: You need to have set AutoGenerateFields="True". If not, you need to add the new FieldLayout as well.
Alex.
had the same problem.
just to elaborate on the answer provided, I used the following command and now it works:
xamDataGridVector.FieldLayouts.Clear();
The FieldLayout is perhaps already set, try to reset the FieldLayouts[0] object, or use multiple XamDataGrid objects.
You could use a stackpanel and set the proper visibilites of the different grid objects.