[]
        
(Showing Draft Content)

Generating Property Methods Automatically

By default when you set the C1PropertyGrid.SelectedObject property to bind to an object, the members listed in the C1PropertyGrid control will be automatically generated. This is because the C1PropertyGrid.AutoGenerateProperties property is set to True by default. You can set the SelectedObject property to False if you do not want properties to be automatically generated. You might do so, for example, if you want only a few properties to be editable or you want to customize the way properties appear in the C1PropertyGrid window.

While properties are visible by default, however, methods are not. By default the AutoGenerateMethods property is set to False and methods are not automatically displayed. If you choose, you can automatically generate methods by setting the AutoGenerateMethods property to True.

Sorting Members in C1PropertyGrid

By default properties and methods are listed alphabetically in the C1PropertyGrid control, similar to the Alphabetic view in the Visual Studio Properties window. However, you can customize the way members are listed by setting the C1PropertyGrid.PropertySort property. The C1PropertyGrid control can sort the properties in any of the following ways:

  • Alphabetical: the properties are sorted in an alphabetical list. This is the default setting and appears similar to the Alphabetic view in the Visual Studio Properties window
  • Categorized: the categories are displayed in an alphabetical list, the properties in each category are displayed in no particular order (the order in which are retrieved from the SelectedObject).
  • CategorizedAlphabetical: the categories are displayed in an alphabetical list; the properties in each category are displayed in alphabetical order. This appears similar to the Categorized view in the Visual Studio Properties window.
  • CategorizedCustom: the categories are displayed in an alphabetical list; the properties inside each category are displayed in a custom order defined by the user using the Display.Order attribute.
  • Custom: the properties are displayed in custom order defined by the user using the Display.Order attribute.
  • NoSort: properties are displayed in the order in which they are retrieved from the SelectedObject.

Set the C1PropertyGrid.PropertySort property to one of the above options to customize the way the property grid is sorted.