【发布时间】:2015-07-28 14:20:58
【问题描述】:
我有一个 UserControl 和一个数据对象,我想将它们绑定在一起,因此 WPF 用户控件始终在对象中呈现数据:
public partial class PersonRectangle : UserControl
{
public PersonRectangle()
{
InitializeComponent();
}
}
public class Person
{
public string fname;
public string lname;
public Person()
{
}
}
将任何 Person 连接到关联的 wpf 视图的最佳方法是什么?我应该将Person 类型的属性添加到部分类PersonRectangle 中吗?考虑到 MVVM 范例,我应该如何做到这一点?
【问题讨论】:
标签: c# wpf xaml mvvm user-controls