How can I prevent selected items on treelistview child nodes?
Thank you
2 Answers, 1 is accepted
0
Accepted
Stefan
Telerik team
answered on 30 Jul 2015, 01:19 PM
Hi Stefania,
The check for such restriction should be performed on data-level. You can subscribe to the SelectionChanging event of RadTreeListView. SelectionChangingEventArgs exposes a property, from which you can benefit: AddedItems. You can check if the child collection contains the currently selected item with logic similar to the one proposed below:
var clubs = (this.treeFileSystem.ItemsSource as ObservableCollection<Club>)
.Where(c => c.NestedClubs.Contains(selected));
if (clubs.Count() > 0)
{
e.Cancel = true;
}
}
}
Can you please give the approach a try and let me know should you need further assistance?
Best Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items