Click or drag to resize
RadTreeViewLoadOnDemand Event
Occurs when a child TreeView item is loading its child items on demand. See the IsLoadOnDemandEnabled property.

Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.Navigation (in Telerik.Windows.Controls.Navigation.dll) Version: 2018.2.515.40 (2018.2.515.40)
Syntax
public event EventHandler<RadRoutedEventArgs> LoadOnDemand

Value

Type: SystemEventHandlerRadRoutedEventArgs
Examples
Following code fragment shows the basic usage.
void RadTreeView1_LoadOnDemand(object sender, RadRoutedEventArgs e)
{
    // get a reference to the item that is loading on demand
    RadTreeViewItem loadOnDemandItem = e.Source as RadTreeViewItem;

    // get the data for the new items
    // from web services or from another data set
    // of just create them declaratively like that:
    RadTreeViewItem newItem = new RadTreeViewItem();
    newItem.Header = "New Item";

    // add the new item(s) as a childs of the item that is loading on demand
    loadOnDemandItem.Items.Add(newItem);

    // if there are not items to add you can skip the loading animation
    // by setting the IsLoadingOnDemand property to false
    loadOnDemandItem.IsLoadingOnDemand = false;

    // if there are no items to add at this moment and you want to 
    // stop the LoadOnDemand event from firing again set 
    loadOnDemandItem.IsLoadOnDemandEnabled = false;
}
See Also