我在WPF应用程序中有一个ViewModel,它具有以下两个属性:
public Customer Customer { get; set; }
public ObservableCollection<Customer> Customers { get; set; }在我的视图中,我有一个DXGrid。如何将所选项目绑定到客户属性?
发布于 2013-03-26 20:39:53
您应该使用SelectedRowsSource属性。将其绑定到ObservableCollection<Customer>。您的代码将如下所示:
public ObservableCollection<Customer> SelectedCustomers { get; set; }
public ObservableCollection<Customer> Customers { get; set; }……
<dxg:GridControl ItemsSource="{Binding Customers}" AutoPopulateColumns="True">
<dxg:GridControl.View>
<dxg:TableView MultiSelectMode="Row" NavigationStyle="Row"
SelectedRowsSource="{Binding SelectedCustomers}" />
</dxg:GridControl.View>
</dxg:GridControl>https://stackoverflow.com/questions/15636330
复制相似问题