Mark said:
I need to format the cells of one Column of DataGrid, on the Pocket PC
with Windows CE vers. 4.2
The problem is that in the libreries of C# for Windows CE, there isn't
the paint method of DataGridTextBoxColumn, which i used for paint the
cell.
Howewer i don't know the alternative metodology to format each cell of
one column, differently.
I help you for some council!!!!!!!!!!!
Create a DataGirdTableStyle, then create and add DataGridColumn objects
to it, each with its own formatting. Here is a working sample from a
Mobile5 app I have written:
<code>
this.dt = new DataTable();
DataColumn col_seq = new DataColumn("Seq",
Type.GetType("System.Int32"));
this.dt.Columns.Add(col_seq);
DataColumn col_desc = new DataColumn("Description",
Type.GetType("System.String"));
this.dt.Columns.Add(col_desc);
DataColumn col_value = new DataColumn("Value",
Type.GetType("System.Decimal"));
this.dt.Columns.Add(col_value);
DataGridTableStyle style = new DataGridTableStyle();
DataGridTextBoxColumn SeqColumn = new
DataGridTextBoxColumn();
SeqColumn.MappingName = "Seq";
SeqColumn.HeaderText = "Seq";
SeqColumn.Width = 50;
style.GridColumnStyles.Add(SeqColumn);
DataGridTextBoxColumn LhsColumn = new
DataGridTextBoxColumn();
LhsColumn.MappingName = "Description";
LhsColumn.HeaderText = "Description";
LhsColumn.Width = 270;
style.GridColumnStyles.Add(LhsColumn);
DataGridTextBoxColumn ValueColumn = new
DataGridTextBoxColumn();
ValueColumn.MappingName = "Value";
ValueColumn.HeaderText = "Value";
ValueColumn.Width = 100;
style.GridColumnStyles.Add(ValueColumn);
this.dg.TableStyles.Add(style);
this.dg.DataSource = this.dt;
</code>
HTH,
Joel