Share via


FeatureConnectorAttribute クラス

FeatureProvider の処理に必要な FeatureConnector<TFeatureProviderType> の型を示します。

継承階層

System.Object
  System.Attribute
    Microsoft.Windows.Design.Features.FeatureConnectorAttribute

名前空間:  Microsoft.Windows.Design.Features
アセンブリ:  Microsoft.Windows.Design.Extensibility (Microsoft.Windows.Design.Extensibility.dll 内)

構文

'宣言
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True)> _
Public NotInheritable Class FeatureConnectorAttribute _
    Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true)]
public sealed class FeatureConnectorAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = true)]
public ref class FeatureConnectorAttribute sealed : public Attribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true)>]
type FeatureConnectorAttribute =  
    class
        inherit Attribute
    end
public final class FeatureConnectorAttribute extends Attribute

FeatureConnectorAttribute 型で公開されるメンバーは以下のとおりです。

コンストラクター

  名前 説明
パブリック メソッド FeatureConnectorAttribute FeatureConnectorAttribute クラスの新しいインスタンスを初期化します。

このページのトップへ

プロパティ

  名前 説明
パブリック プロパティ FeatureConnectorType インスタンス化する FeatureConnector<TFeatureProviderType> の型を取得します。
パブリック プロパティ TypeId 一意の属性の決定に使用されるオブジェクトを取得します。 (Attribute.TypeId をオーバーライドします。)

このページのトップへ

メソッド

  名前 説明
パブリック メソッド Equals このインスタンスが、指定したオブジェクトに等しいかどうかを示す値を返します。 (Attribute.Equals(Object) をオーバーライドします。)
プロテクト メソッド Finalize オブジェクトがガベージ コレクションにより収集される前に、そのオブジェクトがリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。)
パブリック メソッド GetHashCode 対象のインスタンスのハッシュ コードを返します。 (Attribute.GetHashCode() をオーバーライドします。)
パブリック メソッド GetType 現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。)
パブリック メソッド Match 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。)
プロテクト メソッド MemberwiseClone 現在の Object の簡易コピーを作成します。 (Object から継承されます。)
パブリック メソッド ToString 現在のオブジェクトを表す文字列を返します。 (Object から継承されます。)

このページのトップへ

明示的インターフェイスの実装

  名前 説明
明示的なインターフェイス実装プライベート メソッド _Attribute.GetIDsOfNames 名前のセットを対応するディスパッチ識別子のセットにマッピングします。 (Attribute から継承されます。)
明示的なインターフェイス実装プライベート メソッド _Attribute.GetTypeInfo オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。 (Attribute から継承されます。)
明示的なインターフェイス実装プライベート メソッド _Attribute.GetTypeInfoCount オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (Attribute から継承されます。)
明示的なインターフェイス実装プライベート メソッド _Attribute.Invoke オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。 (Attribute から継承されます。)

このページのトップへ

解説

FeatureProvider で必要なサービスを発行する FeatureConnector<TFeatureProviderType> を指定するには、FeatureConnectorAttribute をカスタム FeatureProvider クラスに適用します。

FeatureConnectorAttribute を使用して FeatureConnector<TFeatureProviderType> クラスと DiagnosticsMenuProvider という名前のカスタム機能プロバイダーを関連付ける方法を次のコード例に示します。 完全なコードの一覧については、「方法 : カスタム機能コネクタを作成する」を参照してください。

' 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 

        Items.Add(action)    
    End Sub

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

        service.ShowWindow()

    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. 
[FeatureConnector(typeof(DiagnosticsFeatureConnector))]
public class DiagnosticsMenuProvider : PrimarySelectionContextMenuProvider 
{
    public DiagnosticsMenuProvider() 
    {
        MenuAction action = new MenuAction("Feature Diagnostics...");

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

        Items.Add(action);
    }

    void action_Execute(object sender, MenuActionEventArgs e)
    {
        IDiagnosticsService service = 
            e.Context.Services.GetRequiredService<IDiagnosticsService>();

        service.ShowWindow();
    }
}

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバーは、スレッド セーフです。 インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

参照

参照

Microsoft.Windows.Design.Features 名前空間

FeatureManager

FeatureProvider

FeatureConnector<TFeatureProviderType>

その他の技術情報

機能プロバイダーと機能コネクタ

WPF デザイナーの機能拡張について