Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 1.01 KB

File metadata and controls

17 lines (14 loc) · 1.01 KB

How to Load Data on Demand using Command in WPF TreeGrid?

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));
    }
}