Question

I build the Radtreeview with child items, using the load on demand event to load the child items and it works for fine.

The problem here is for every child item there is expand sign but there is a point there are no child items for a parent, in that case for the child items I don't want show the expand sign. How can I achieve this ?

Was it helpful?

Solution

I found the answer there is a property called IsLoadOnDemandEnabled and set this property to false on ItemPrepared event.

                  <telerik:RadTreeView  x:Name="radTreeView" 
                             IsExpandOnSingleClickEnabled="True"
                             IsLoadOnDemandEnabled="true" 
                             LoadOnDemand="RadTreeView_LoadOnDemand"
                            ItemPrepared="radTreeView_ItemPrepared"
                            ItemsSource="{Binding TreeViewSource,Mode=OneWay}" 
                         ItemTemplate="{StaticResource ParentTemplate}"
                         />

and in the xaml.cs

    private void radTreeView_ItemPrepared(object sender, RadTreeViewItemPreparedEventArgs e)
    {
        // get a reference to the item that has been selected
        RadTreeViewItem preparedItem = e.PreparedItem as RadTreeViewItem;
            preparedItem.IsLoadOnDemandEnabled = false;
    }

for reference http://www.telerik.com/help/wpf/radtreeview-features-load-on-demand.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top