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 多載