I am using WPF datagrid. Data I am binding to the grid is not having fixed number of columns, so I have set AutoGeneratedColumns to True.
<DG:TestDataGrid x:Name="grTestData" ItemsSource="{Binding}" LoadingRow="grTestData_LoadingRow" UnloadingRow="grTestData_UnloadingRow" AutoGeneratingColumn="grTestData_AutoGeneratingColumn" AutoGenerateColumns="True" Visibility="Visible" SelectionUnit="CellOrRowHeader"></DG:TestDataGrid>
As auto-generated columns are used, where ever it encounters column of type bool it uses DataGridCheckbox columns. When user is closing the this screen, I am saving data assigned to data grid in an xml file.
ds.Tables[0].WriteXml(path);
//here path is the place where I am storing the xml
again when user is opening the sceen I am loading data from xml and assigning it back to grid.
ds.ReadXmlSchema(path);
ds.ReadXml(path);
grTestData.ItemsSource=ds.Table[0].DefaultView
Now the problem is, boolean columns are not showing checkboxes. It is showing text values in the columns “True” for checkboxes which were checked earlier and false for unchecked checkboxes. Please guide me, how can I prevent it. If you need any other info on code… plz mention it. I will paste it here.
Regards,
Priyank
Specify the writng mode by passing System.Data.XmlWriteMode.WriteSchema into WriteXML.