次の方法で共有


DataContextValueSourceAttribute コンストラクター (String, String, Boolean)

指定したプロパティ名、先祖パス、およびコレクション情報を使用して、DataContextValueSourceAttribute クラスの新しいインスタンスを初期化します。

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

構文

'宣言
Public Sub New ( _
    dataContextValueSourceProperty As String, _
    ancestorPath As String, _
    isCollectionItem As Boolean _
)
public DataContextValueSourceAttribute(
    string dataContextValueSourceProperty,
    string ancestorPath,
    bool isCollectionItem
)
public:
DataContextValueSourceAttribute(
    String^ dataContextValueSourceProperty, 
    String^ ancestorPath, 
    bool isCollectionItem
)
new : 
        dataContextValueSourceProperty:string * 
        ancestorPath:string * 
        isCollectionItem:bool -> DataContextValueSourceAttribute
public function DataContextValueSourceAttribute(
    dataContextValueSourceProperty : String, 
    ancestorPath : String, 
    isCollectionItem : boolean
)

パラメーター

  • dataContextValueSourceProperty
    型: System.String
    データ コンテキストの値のソースであるプロパティの名前。
  • ancestorPath
    型: System.String
    データ コンテキスト プロパティに到達する際に走査する先祖プロパティのセットを示すプロパティ パス。
  • isCollectionItem
    型: System.Boolean
    データ コンテキストがコレクション内の項目であるかどうかを示します。

解説

次の XAML フラグメントは、複数の異なるデータ コンテキストを持つツリーを示しています。

<ListView.View>
    <GridView>
        <GridViewColumn Header="Customer ID" Width="80">
            <GridViewColumn.CellTemplate>
                <DataTemplate>

データ コンテキストの継承の親パスを指定する方法を次のコードに示します。 builder は、AttributeTableBuilder インスタンスへの参照です。 このコードは、CellTemplate プロパティへのプロパティ パスが "View"、"Columns"、および "" であることを指定します。

builder.AddCustomAttributes("CellTemplate", new DataContextPropertyAttribute("ItemsSource", @"(ListView.View).(GridView.Columns)\", true));

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

DataContextValueSourceAttribute クラス

DataContextValueSourceAttribute オーバーロード

Microsoft.Windows.Design 名前空間

その他の技術情報

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