Edit

Share via


AccessDataSourceDesigner.PreFilterProperties(IDictionary) Method

Definition

Used by the designer to add properties to, or remove them from, the Properties grid or to shadow properties of the associated control.

protected:
 override void PreFilterProperties(System::Collections::IDictionary ^ properties);
protected override void PreFilterProperties (System.Collections.IDictionary properties);
override this.PreFilterProperties : System.Collections.IDictionary -> unit
Protected Overrides Sub PreFilterProperties (properties As IDictionary)

Parameters

properties
IDictionary

A collection implementing the IDictionary of the added and shadowed properties.

Examples

The following code example shows how to override the PreFilterProperties method to make the ConnectionString property read-only and visible in the Properties grid.

This code example is part of a larger example provided for the AccessDataSourceDesigner class.

// Shadow control properties with design time properties.
protected override void PreFilterProperties(IDictionary properties)
{
    // Call the base class method first.
    base.PreFilterProperties(properties);

    // Add the ConnectionString property to the property grid.
    PropertyDescriptor property =
        (PropertyDescriptor)properties["ConnectionString"];
    Attribute[] attributes = new Attribute[]
    {
        new BrowsableAttribute(true),
        new ReadOnlyAttribute(true)
    };
    properties["ConnectionString"] = TypeDescriptor.CreateProperty(
        GetType(), property, attributes);
}
' Shadow control properties with design time properties.
Protected Overrides Sub PreFilterProperties(ByVal properties As IDictionary)

    ' Call the base class method first.
    MyBase.PreFilterProperties(properties)

    ' Add the ConnectionString property to the property grid.
    Dim prop As PropertyDescriptor
    prop = CType(properties("ConnectionString"), PropertyDescriptor)

   Dim atts(1) As Attribute
    atts(0) = New BrowsableAttribute(True)
    atts(1) = New ReadOnlyAttribute(True)

    properties("ConnectionString") = TypeDescriptor.CreateProperty( _
        prop.GetType(), prop, atts)
End Sub

Remarks

Control designers use methods that are derived from the ComponentDesigner.PreFilterProperties method to shadow various control properties with corresponding design-time properties that the designer implements, and to add properties to, or remove them from, the Properties grid.

For the AccessDataSource control, the PreFilterProperties method creates the design-time DataFile property to shadow the DataFile property of the control.

Notes to Inheritors

Override the PreFilterProperties(IDictionary) method to add properties to the design-time property collection or change their attributes. Be sure to call the base method before performing other processing.

Applies to

See also