Row height in datagrid

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[] {});
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top