簡體   English   中英

Silverlight數據和元素綁定

[英]Silverlight Data and Element Binding

兩者有什么區別?

DataContext="{Binding SelectedItem, ElementName=listBoxStudents}

DataContext="{Binding ElementName=listBoxStudents, Path=SelectedItem}

在Apress Pro Silverlight 4中,第二個示例是簡單的元素到元素綁定。 我認為第一個示例與數據綁定有關。

在我的應用中,它們執行相同的操作。 有人可以澄清嗎?

您呈現的兩行含義完全相同。 兩者都指定到名稱為listBoxStudents的元素的SelectedItem屬性的listBoxStudents

如果Path屬性在{Binding ...}在首位,則可能會錯過Path=部分。 除此之外, {Binding ...}的屬性順序並不重要。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM