This example illustrates how to load data on demand using command in WPF TreeGrid (SfTreeGrid).
You can load child items for the node in Execute method of LoadOnDemandCommand. Execute method will get called when user expands the tree node. In Execute method, you can populate the child nodes by calling TreeNode.PopulateChildNodes method by passing the child items collection.
public void Execute(object parameter)
{
TreeNode node = (parameter as TreeNode);
EmployeeInfo emp = node.Item as EmployeeInfo;
if (emp != null)
{
node.PopulateChildNodes((App.Current.MainWindow.DataContext as ViewModel).GetReportees(emp.ID));
}
}