【发布时间】:2013-09-16 12:04:39
【问题描述】:
我在 Windows Phone 中进行绑定时遇到问题。希望你能帮助我。
我有以下数据模板:
<DataTemplate>
<TextBox Name="txt1"/><TextBox Name="txt2"/></DataTemplate>
我有一个 ListBox,它在 ItemsSource 属性中接收以下类:
public class Product
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
}
有没有办法将 Text 属性与 ListBoxItem 的 Object 绑定,比如...
<TextBox Name="txt1" Text={Binding ElementName=ListBox, Path=SelectedItem.Product.Name}/>
【问题讨论】:
标签: binding windows-phone-8 listbox windows-phone