Datagrid and XamlWriter.Save

Jan 14, 2010 at 9:40 AM


When I create a new DataGrid in code and add a column to it like:

var myDataGrid = new DataGrid();
var column = new DataGridTextColumn { Header = "Header" };

I would like to generate the XAML of it via the XamlWriter.Save(myDataGrid).

The output of the XamlWriter.Save results in a <DataGrid>...</DataGrid>tag but i'm missing the DataGridTextColumn :(

It looks like the XamlWriter isn't saving the datagrid columns to the Xaml output :(

Any idea why? Or am I missing something? Is there a workaround for this?



Mar 22, 2010 at 7:32 AM

Hi, I have this problem too. I just start reading about how the serialization process work. 

Please if you found how to solve this post the solution. Thanks.

May 12, 2010 at 5:38 AM
I have the same problem too, it seems to be a bug