假设我有Employee类的ObservableCollection
排序的ObservableCollection
public ObservableCollection<Employee> employeeCollection = new ObservableCollection<Employee>();
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public double MobileNumber { get; set; }
public string City { get; set; }
public int Age { get; set; }
public Employee() {}
}
我现在想通过组合框的用户进行排序ObservableCollection
(“employeeCollection”) 适当选择[这将是...的.sort通过名字... .Sort By MobileNumber etc ...]
并且它需要取回已排序的可观察集合...。 意味着它不应该在“VAR”的形式,它应该是 ObservableCollection<Employee>
所以我可以分配回它的“ItemsControl”
“ItemsSource”
财产......
感谢......
你为什么要排序的集合?您还可以对数据绑定执行排序。 – PVitt 2011-04-27 12:06:19
[在我的应用程序中,“Item controle”显示每个员工都在可观察的集合中,现在我想对可观察的集合进行排序,因此我的应用程序的UI将根据可观察的集合进行排序......谢谢] – Pritesh 2011-04-27 12:14:06
当您接受答案时... – PVitt 2011-12-08 08:44:35