Hi
I have a DataGrid that I am using to display a .xml file (that has a schema
in a .xsd), like this:-
ds.ReadXmlSchem a(sDataPath + "Data.xsd") ;
ds.ReadXml(sDat aPath + "Data.xml", XmlReadMode.Inf erSchema);
grdXXXX.DataSou rce = ds;
FormatGridColum ns(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 FormatGridColum ns(DataGrid Grid, DataTable Table)
{
DataGridTableSt yle ts = new DataGridTableSt yle();
foreach (DataColumn c in Table.Columns)
{
ts.GridColumnSt yles.Add(...... .......somethin g
// 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.ReadXmlSchem a(sDataPath + "Data.xsd") ;
ds.ReadXml(sDat aPath + "Data.xml", XmlReadMode.Inf erSchema);
grdXXXX.DataSou rce = ds;
FormatGridColum ns(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 FormatGridColum ns(DataGrid Grid, DataTable Table)
{
DataGridTableSt yle ts = new DataGridTableSt yle();
foreach (DataColumn c in Table.Columns)
{
ts.GridColumnSt yles.Add(...... .......somethin g
// test the datatype and set up the formatting ....
}
..........
}
Does that make sense? I need a pointer to get me going again!
Cheers
Jeff
Comment