FeatureProvider Class

Adds a class-specific contribution to a feature.

Inheritance Hierarchy


Namespace:  Microsoft.Windows.Design.Features
Assembly:  Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)


Public MustInherit Class FeatureProvider
public abstract class FeatureProvider
public ref class FeatureProvider abstract
type FeatureProvider =  class end
public abstract class FeatureProvider

The FeatureProvider type exposes the following members.


  Name Description
Protected method FeatureProvider Initializes a new instance of the FeatureProvider class.



  Name Description
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)



Derive from the abstract FeatureProvider class to extend the design-time for your custom controls.

Feature providers are managed by feature connectors and are associated to objects through the FeatureAttribute metadata attribute. The feature connector discovers FeatureProvider types from this metadata. The FeatureManager identifies the required feature connector for every feature provider discovered.

Common feature provider implementations include selection adorners, context menus, and property editors.

To attach a feature provider to the primary selection on the design surface, derive from one of the feature providers with the PrimarySelectionPolicy applied, for example PrimarySelectionAdornerProvider or



The following code example shows how to derive from the FeatureProvider class to implement a custom feature provider named DiagnosticsMenuProvider with a custom service named IDiagnosticsService. For a complete code listing, see How to: Create a Custom Feature Connector.

' The DiagnosticsMenuProvider class adds a context menu item
' that displays a dialog box listing the currently running and 
' pending feature connectors. 
<FeatureConnector(GetType(DiagnosticsFeatureConnector))>  _
Public Class DiagnosticsMenuProvider
    Inherits PrimarySelectionContextMenuProvider

    Public Sub New() 
        Dim action As New MenuAction("Feature Diagnostics...")

        AddHandler action.Execute, AddressOf action_Execute 

    End Sub

    Sub action_Execute(ByVal sender As Object, ByVal e As MenuActionEventArgs) 
        Dim service As IDiagnosticsService = e.Context.Services.GetRequiredService(Of IDiagnosticsService)()


    End Sub

End Class
// The DiagnosticsMenuProvider class adds a context menu item
// that displays a dialog box listing the currently running and 
// pending feature connectors. 
public class DiagnosticsMenuProvider : PrimarySelectionContextMenuProvider 
    public DiagnosticsMenuProvider() 
        MenuAction action = new MenuAction("Feature Diagnostics...");

        action.Execute += new EventHandler<MenuActionEventArgs>(action_Execute); 


    void action_Execute(object sender, MenuActionEventArgs e)
        IDiagnosticsService service = 


Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also


Microsoft.Windows.Design.Features Namespace





Other Resources

How to: Create a Custom Feature Connector

Feature Providers and Feature Connectors

Understanding WPF Designer Extensibility