J
Jeff Cook
Hi
I have a DataGrid that I am using to display a .xml file (that has a schema
in a .xsd), like this:-
ds.ReadXmlSchema(sDataPath + "Data.xsd");
ds.ReadXml(sDataPath + "Data.xml", XmlReadMode.InferSchema);
grdXXXX.DataSource = ds;
FormatGridColumns(grdXXXX, ds.Tables["XXXX"]); // my routine below.
OK so far. Now I want to format the columns in the grid. I can't hard code
this as I don't know in advance what will be in the xml file.
I want to do check boxes if the column is boolean otherwise plain boxes,
except that I want to right justify decimal columns and left justify the
rest.
This what I have done so far (not much!):-
private void FormatGridColumns(DataGrid Grid, DataTable Table)
{
DataGridTableStyle ts = new DataGridTableStyle();
foreach (DataColumn c in Table.Columns)
{
ts.GridColumnStyles.Add(.............something
// test the datatype and set up the formatting ....
}
..........
}
Does that make sense? I need a pointer to get me going again!
Cheers
Jeff
I have a DataGrid that I am using to display a .xml file (that has a schema
in a .xsd), like this:-
ds.ReadXmlSchema(sDataPath + "Data.xsd");
ds.ReadXml(sDataPath + "Data.xml", XmlReadMode.InferSchema);
grdXXXX.DataSource = ds;
FormatGridColumns(grdXXXX, ds.Tables["XXXX"]); // my routine below.
OK so far. Now I want to format the columns in the grid. I can't hard code
this as I don't know in advance what will be in the xml file.
I want to do check boxes if the column is boolean otherwise plain boxes,
except that I want to right justify decimal columns and left justify the
rest.
This what I have done so far (not much!):-
private void FormatGridColumns(DataGrid Grid, DataTable Table)
{
DataGridTableStyle ts = new DataGridTableStyle();
foreach (DataColumn c in Table.Columns)
{
ts.GridColumnStyles.Add(.............something
// test the datatype and set up the formatting ....
}
..........
}
Does that make sense? I need a pointer to get me going again!
Cheers
Jeff