Version

Configuring Brush Resources (xamPropertyGrid)

Purpose

This topic explains how to configure the brush resources panel of the brush editor.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic explains the features supported by the control from developer perspective.

This topic provides an overview of the visual elements of the control.

In this topic

This topic contains the following sections:

Overview

When scrolling the properties list the property editors are constantly coming in and out of view. When a brush type property editor is coming into view the BrushResourcesLoading event is raised. You have the ability to customize the brush editor’s user interface in the event’s handler using the event arguments object of type BrushResourcesEventArgs. This arguments object also include a reference to the PropertyGridPropertyItem associated with the brush property coming into view.

Customizing Brush Resources

xamPropertyGrid_Brush_Resources.png

As visible on the picture above the brush resources panel divides the brushes in two groups – "Local Brush Resources" and "System Brush Resources". You can customize the brush entries in these groups by either adding your own brush definitions and/or including the system brushes.

To include the system brushes you need to set the AutomaticallyIncludeSystemBrushResources boolean property to true and this will include all colors from the current Windows theme in the "System Brush Resources" group.

To add your own brushes to one of these two groups use the BrushResources property and add objects of type PropertyGridBrushResourceItem. This type contains all information related to the brush resource entry – the brush itself, the brush name, the brush group and a Tag property of type object used to store arbitrary information.

Note
Note

If you do not add brush resources items to the BrushResources property and you do not set the AutomaticallyIncludeSystemBrushResources property to true, the button for showing the brush resources panel will not be visible.

Get Notified When a Brush is Selected

When the user selects a brush entry from the brush resources list a BrushResourceSelected event is raised. The event arguments object of this event provides the following properties:

  • PropertyItem – this property of type PropertyGridPropertyItem is associated with the brush property whose brush has changed.

  • BrushResource – this property of type PropertyGridBrushResourceItem comprises all information related to the selected brush entry.

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains how to customize the editors used for editing the properties' values.

This topic explains how to configure the filtering of the control’s properties list.

This topic explains how to provide logic for custom sorting of the properties list.

This topic explains how create custom logic for assigning editing template on an editor definition.