此教程示范如何添加TreeListControl到项目和绑定控件自引用数据源:

添加数据模型
绑定tree,并添加如下字段到数据源对象:
Key字段包含唯一值索引节点
Parent字段包含父索引节点
添加数据模型(Employee和Staff类)到MainWindow.xaml.cs 文件:
namespace DxTreeListGettingStarted {
public partial class MainWindow : Window { ... }
public class Employee {
public int ID { get; set; }
public int ParentID { get; set; }
public string Name { get; set; }
public string Position { get; set; }
public string Department { get; set; }
}
public static class Staff {
public static List<Employee> GetStaff() {
List<Employee> staff = new List<Employee>();
staff.Add(new Employee() { ID = 0, Name = "Gregory S. Price", Department = "", Position = "President" });
staff.Add(new Employee


4639

被折叠的 条评论
为什么被折叠?



