Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load on demand with telerik radtreeview

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 ?

like image 847
GANI Avatar asked Sep 28 '12 04:09

GANI


1 Answers

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

like image 184
GANI Avatar answered Sep 18 '22 10:09

GANI