[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Collapse]Property Grid
    Overview
   [Expand]Getting Started
   [Collapse]Property Definitions
     Collection Definitions
     Binding to a collection of PropertyDefinitions
     Displaying Multiple Properties in a Single Cell
    Property Attributes
    Property Categories
    Descriptions
    Expandability Customization
    Property Menu
   [Expand]Visual Elements
    Appearance Customization
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Property Definitions

Expanded Overview

Property definitions represent the properties of a bound object and specify their appearance within the property grid. Each property definition is linked to one or multiple properties of the bound object. Property definitions are represented by PropertyDefinition objects that are stored within the PropertyGridControl.PropertyDefinitions collection.

Expanded Managing Property Grid Content

Depending on the PropertyGridControl.ShowProperties value, the property grid displays the following content.

PropertyGridControl.ShowProperties
value
PropertyGridControl content
All The property grid displays all properties of an object.
WithPropertyDefinitions The property grid displays only the properties that are specified by the property definitions.

The following example demonstrates a property grid that displays two properties of the bound object.

Expanded Linking Properties to Definitions

You can link a property of an object to a property definition using an association criteria. Different criteria and combinations of criteria have different priorities. When an object property matches multiple definitions, the PropertyGrid control links it to the definition with the highest priority. The following table lists the available association criteria and their priorities.

Criteria Priority Description
Property path High Use the PropertyDefinitionBase.Path property to specify the direct path to the associated property.
Parent property path Medium Use the PropertyDefinition.Scope property to specify the path to the parent property (see Nested Properties).
Property type Low Use the PropertyDefinition.Type property to specify the type of the associated property.
The PropertyDefinition.TypeMatchMode property specifies the rules of type matching. See TypeMatchMode to learn more.
Important

You can use the asterisk * character as a placeholder for a property name when specifying the criteria with the PropertyDefinitionBase.Path and PropertyDefinition.Scope properties.

Tip

You can specify child property definitions using the PropertyDefinition.InsertDefinitionsFrom property.

The following example demonstrates how to use property definitions to display only the string properties of the bound object.

Expanded Custom Editors and Property Editing

The PropertyGridControl automatically assigns editors to the edit fields based on the corresponding property type. Property definitions allow you to specify and configure custom in-place editors for the associated properties of the bound object. The following example demonstrates how to assign editors to property grid rows based on the property path and type.

Note

Property definitions that use the TokenComboBoxStyleSettings should have the PropertyDefinitionBase.IsReadOnly property set to true to enable editing.

Note

The PropertyGridControl.SelectedObjects property allows for the editing of properties of multiple objects. A property whose value differs between objects has a blank value in the property grid. Editing such a property using the property grid changes it for all selected objects simultaneously.

Expanded Nested Properties

The PropertyGrid control can display nested properties as an expandable list. Use the System.ComponentModel.TypeConverter attribute and specify the ExpandableObjectConverter type converter for a property to make it expandable.

The following example demonstrates how to display nested properties within the PropertyGrid control.

Note

To learn more about property expandability and type converters, see Expandability Customization.

Expanded See Also

Is this topic helpful?​​​​​​​