Categorizing Properties

You can group properties by category by adding a Category attribute to each property on the object being browsed (note that the Category attribute is defined in the System.ComponentModel namespace, in the System.Windows assembly). By default the members in the list will be listed alphabetically and uncategorized. By adding categories you can better organize members by listing related members together.

Continuing with our example, here's a revised version of the Customer class which includes categories:

      Visual Basic

      C#

And here is the result of this change:

 

 

Notice how properties are neatly grouped by category. Each group can be expanded and collapsed, making it easier for the user to find specific properties.

You can also use the DefaultCategoryName property to set the name of a default category which will contain all the properties that have no other category defined.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.