Provides an interface to modify the set of member descriptors for a component in design mode.
Assembly: System (in System.dll)
Thetype exposes the following members.
The interface provides an interface that allows modification of the properties, events, and class-level attributes of a component at design time. This modification occurs through the set of descriptors that a component provides through a TypeDescriptor. The type descriptor will query a component's site for the service and, if it exists, the type descriptor will pass all metadata it has collected to this service. The service can then modify the metadata by adding, removing, and altering existing characteristics of the component.
For example, the properties of a component can be modified through a call to the FilterProperties method. The filter service obtains a dictionary that contains property names and their property descriptors of type PropertyDescriptor. The modifications are implemented using the following logic.
Delete the corresponding entry in the dictionary.
Add the appropriate entry to the dictionary.
Call existing property descriptor methods, replace the associated property descriptor entry, or replace the entire property key/value pair in the dictionary.
The return value of FilterProperties determines if this set of properties is fixed. If this method returns true, the TypeDescriptor for this component can cache the results. This cache is maintained until either the component is garbage collected or the Refresh method of the type descriptor is called.Notes to Implementers
To filter the member descriptors exposed by a TypeDescriptor, implement this interface on a component and override the FilterAttributes, FilterEvents, or FilterProperties methods of this class to filter attributes, events, or properties, respectively.
The following code example demonstrates a designer that uses the to filter the attributes collection of any new or existing Button to add a designer attribute for a new designer before loading or reloading the designer for the button.
To use the example, add the code to a Windows Forms project and load the components from the class library into the Toolbox.
Add some buttons to your form. Add a ButtonDesignerFilterComponent to your form, and it will appear in the component tray. The ButtonDesignerFilterComponent will add a ButtonDesignerFilterService, which implements , as a design mode service provider. Existing or new Button objects on the form will begin color cycling after the ButtonDesignerFilterService replaces the designer for each existing and new button with a ColorCycleButtonDesigner. The buttons will color cycle when you move the mouse pointer over them, and alternately continue cycling or reset the background and foreground colors on MouseLeave events. New Button objects will be given the ColorCycleButtonDesigner through the FilterAttributes method of the ButtonDesignerFilterService that has been loaded, until the ButtonDesignerFilterComponent is disposed and replaces the original . The ColorCycleButton class in this example is a Button associated with a ColorCycleButtonDesigner.