I try to adjust the column width of a DataGrid in C# for a Windows Mobile application that will run on a Motorola MC55.
I use the following code to do this:
dataGrid1.TableStyles.Clear();
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.MappingName = t.TableName;
foreach (DataColumn item in t.Columns)
{
DataGridTextBoxColumn tbcName = new DataGridTextBoxColumn();
tbcName.Width = 100;
tbcName.MappingName = item.ColumnName;
tbcName.HeaderText = item.ColumnName;
tableStyle.GridColumnStyles.Add(tbcName);
}
dataGrid1.TableStyles.Add(tableStyle);
This is running fine on the Windows Mobile 6.5.3. Professional Emulator. Unfortunately it is not working on the Motorola MC55.
On the MC55 the column width is even smaller compared to when I uncomment the code shown above.
Can you please help me to get this working on the MC55?
Copyright Notice:Content Author:「Malawirel」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38721837/column-width-of-a-datagrid-in-windows-mobile-application-motorola-mc55