【发布时间】:2012-07-19 17:57:55
【问题描述】:
请帮帮我
我有
public partial class OrderControl : UserControl
{
private OrderHeader orderHeader;
public Customer selectedCustomer { get; set; }
private Customer[] allCustomers;
public User selectedManager { get; set; }
private User[] allManagers;
public OrderControl()
{
InitializeComponent();
DataContext = this;
}
...
}
我需要一种绑定到源的方式:
<ComboBox Name="CustomerComboBox" SelectedItem="{Binding selectedCustomer}"/>
这是将 selectedCustomer 属性保留在 OrderControl.xaml.cs 中的最佳方式,还是我需要使用 ..,selectedCustomer,... 属性创建一些 OrderViewModel 类并在 OrderControl.xaml.cs 中保留 OrderViewModel 的实例?
谢谢
【问题讨论】:
标签: c# wpf xaml mvvm user-controls