How to resize description area in PropertyGrid

From this article you can learn how to resize description area in PropertyGrid. Example shows use of reflection in order to dig to private members of PropertyGrid - not accessible in normal way.

Implementation is available both in C# and VB.Net languages. Use buttons below to switch language visibility.


System.Reflection namespace needs to be put in usings.

private static void ChangeDescriptionHeight(PropertyGrid grid, int height)
  if (grid == null) throw new ArgumentNullException("grid");
  foreach (Control control in grid.Controls)
   if (control.GetType().Name == "DocComment")
      FieldInfo fieldInfo = control.GetType().BaseType.GetField("userSized",
        BindingFlags.Instance |
      fieldInfo.SetValue(control, true);
      control.Height = height;

Private Shared Sub ChangeDescriptionHeight(grid As PropertyGrid, height As Integer)
  If grid Is Nothing Then
    Throw New ArgumentNullException("grid")
  End If
  For Each control As Control In grid.Controls
    If control.[GetType]().Name = "DocComment" Then
      Dim fieldInfo As FieldInfo = control.[GetType]().BaseType.GetField("userSized", 
	    BindingFlags.Instance Or BindingFlags.NonPublic)
      fieldInfo.SetValue(control, True)
      control.Height = height
      End If
End Sub


This Property Grid is able to

Kettic Property Grid is able to display the properties of any object in a user-friendly way and allows the end users of your applications edit the properties of the object.

Post new comment

  • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.

More information about formatting options

This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 0 =
This simple math problem is designed for BOT - you just have to enter '7'.