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 ?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With