private void treeGrid_RequestChildSource(object sender, UI.Xaml.TreeGrid.TreeGridRequestTreeItemsEventArgs args) { if (args.ParentItem == null) { args.ChildItems = viewModel.ItemsCollection; } else { args.ChildItems = viewModel.GetSubItems((args.ParentItem as TreeModel).Name); } }
private void treeGrid_RequestChildSource(object sender, UI.Xaml.TreeGrid.TreeGridRequestTreeItemsEventArgs args) { if (args.ParentItem == null) { //get the root list - get all employees who have no boss args.ChildItems = viewModel.EmployeeDetails.Where(x => x.ReportsTo == -1); //get all employees whose boss's id is -1 (no boss) } else //if ParentItem not null, then set args.ChildList to the child items for the given ParentItem. { //get the children of the parent object EmployeeInfo emp = args.ParentItem as EmployeeInfo; if (emp != null) { //get all employees that report to the parent employee args.ChildItems = viewModel.GetReportees(emp.ID); } } }