ComponentResourceKey コンストラクター

定義

ComponentResourceKey クラスの新しいインスタンスを初期化します。

オーバーロード

ComponentResourceKey()

ComponentResourceKey クラスの新しいインスタンスを初期化します。

ComponentResourceKey(Type, Object)

キーを定義する を指定しType、追加のComponentResourceKeyリソース識別子として使用する オブジェクトを指定して、 クラスの新しいインスタンスを初期化します。

ComponentResourceKey()

ComponentResourceKey クラスの新しいインスタンスを初期化します。

public:
 ComponentResourceKey();
public ComponentResourceKey ();
Public Sub New ()

注釈

適切な初期化には値とResourceId値が必要であるためTypeInTargetAssembly、パラメーターなしのコンストラクターは一般に使用されません。 パラメーターなしのコンストラクターは、主に、名前付きパラメーター 形式での ComponentResourceKey Markup Extension XAML の使用をサポートするために存在します。

適用対象

ComponentResourceKey(Type, Object)

キーを定義する を指定しType、追加のComponentResourceKeyリソース識別子として使用する オブジェクトを指定して、 クラスの新しいインスタンスを初期化します。

public:
 ComponentResourceKey(Type ^ typeInTargetAssembly, System::Object ^ resourceId);
public ComponentResourceKey (Type typeInTargetAssembly, object resourceId);
new System.Windows.ComponentResourceKey : Type * obj -> System.Windows.ComponentResourceKey
Public Sub New (typeInTargetAssembly As Type, resourceId As Object)

パラメーター

typeInTargetAssembly
Type

リソース キーを定義する型。

resourceId
Object

この ComponentResourceKeytypeInTargetAssembly 型に関連付けられている他のキーと区別する一意の識別子。

次の例では、 ComponentResourceKey を作成し、 をコントロール クラスの静的キーとして公開し、スタイルカスタマイズ エントリ ポイントを提供します。

public static ComponentResourceKey ViewBoxStyleKey =
    new ComponentResourceKey(typeof(MyAssemblyResources), "part_ViewBox");
Public Shared ViewBoxStyleKey As New ComponentResourceKey(GetType(MyAssemblyResources), "part_ViewBox")

注釈

このコンストラクターは 2 つのシナリオに存在し、最初のシナリオが最も重要です。

  • カスタム コントロール クラスでパブリック静的フィールドとして公開される の作成 ComponentResourceKey をサポートします。 これにより、テンプレート プロパティ値の使用法を通じて {x:Static} 、テンプレート内の独自に定義されたリソースへのコントロールのアクセスが簡略化されます。

  • ComponentResourceKey Markup Extension XAML の位置指定パラメーター 形式での使用をサポートします。これは、コンポーネント リソースを参照するサード パーティが使用できる手法の 1 つです。

適用対象