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
Marvin Varela - 20 Apr 2005 22:11 GMT
Yes it is
MethodInfo mi =
t.BaseType.GetMethod("get_DataGridRows",BindingFlags.FlattenHierarchy
| BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic
BindingFlags.Public | BindingFlags.Static);
this should return what you need.
> Hi,
>
[quoted text clipped - 37 lines]
>
> Magesh
Magesh - 21 Apr 2005 11:24 GMT
Thanks a lot Marvin.
Magesh
> Yes it is
>
[quoted text clipped - 54 lines]
> >
> > Magesh