G
Guest
Hi,
In order to display multiple lines in a column, i am creating creating a new
column style deriving from the DataGridTextBoxColumn. To get the height of
each row i am using the following code in one of the methods of this custom
columnstyle class.
MethodInfo mi = t.GetMethod("get_DataGridRows",BindingFlags.FlattenHierarchy
| BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Static);
DataGrid dg = this.DataGridTableStyle.DataGrid;
Array dgRowArray = (Array)(mi.Invoke(dg,null));
Heights = new ArrayList();
foreach (object dgRowHeight in dgRowArray)
{
if (dgRowHeight.ToString().EndsWith("DataGridRelationshipRow") == true)
{
Heights.Add(dgRowHeight);
}
}
The above code works perfectly if use this column style in
System.Windows.Forms.DataGrid control.
I am also creating a custom datagrid deriving from the
System.Windows.Forms.DataGrid class .
If i use the above code in the custom DataGrid class, the
MethodInfo mi = t.GetMethod("get_DataGridRows",BindingFlags.FlattenHierarchy
| BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Static);
statement returns null. Is it not possible to obtain the method information
of a base class??
Thanks for the help.
Magesh
In order to display multiple lines in a column, i am creating creating a new
column style deriving from the DataGridTextBoxColumn. To get the height of
each row i am using the following code in one of the methods of this custom
columnstyle class.
MethodInfo mi = t.GetMethod("get_DataGridRows",BindingFlags.FlattenHierarchy
| BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Static);
DataGrid dg = this.DataGridTableStyle.DataGrid;
Array dgRowArray = (Array)(mi.Invoke(dg,null));
Heights = new ArrayList();
foreach (object dgRowHeight in dgRowArray)
{
if (dgRowHeight.ToString().EndsWith("DataGridRelationshipRow") == true)
{
Heights.Add(dgRowHeight);
}
}
The above code works perfectly if use this column style in
System.Windows.Forms.DataGrid control.
I am also creating a custom datagrid deriving from the
System.Windows.Forms.DataGrid class .
If i use the above code in the custom DataGrid class, the
MethodInfo mi = t.GetMethod("get_DataGridRows",BindingFlags.FlattenHierarchy
| BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Static);
statement returns null. Is it not possible to obtain the method information
of a base class??
Thanks for the help.
Magesh