Row height in datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

If i execute the code below, i change the row height of my datagrid to be
able to display datatable1. But then i want to display datatable2 in the
datagrid using the default row heights.
How do i switch back to the default datagrid row heights?

thank you.

Code:

cy is the row height in pixels you desire:

private void _setGridDefaultRowHeight(DataGrid dg, int cy)
{
FieldInfo fi = dg.GetType().GetField("m_cyRow",
BindingFlags.NonPublic |
BindingFlags.Static |
BindingFlags.Instance);

fi.SetValue(dg, cy);

dg.GetType().GetMethod("_DataRebind",
BindingFlags.NonPublic |
BindingFlags.Static |
BindingFlags.Instance).Invoke(dg, new object[] {});
}
 
Back
Top