Setting Focusable On RadTreeViewItem does not Follow the Default Foucable Behaviour

2 posts, 0 answers
  1. Jawad
    Jawad avatar
    10 posts
    Member since:
    Jul 2013

    Posted 22 Jul 2013 Link to this post

    In the Telerik Radtreeview I want some of the treeviewitems to be unSelectable until the previous steps are completed. In the background I have a Boolean property isSelectable which is Binded to the TreeviewItem Focusable Property. Before when I was using the windows TreeView Control this Focusable property made the treeviewitems to be UnSelected until the previous steps were completed which is a default behaviour in windows control. Now after converting to the telerik Radtreeview control I can select items even with focusable property set to false And also the treeviewitem are highlighted on hovering over the item. Is there a way I can make it to work so that on setting the RadTreeviewItem focusable property to false the respective Radtreeviewitems are not selectable and shouldn’t highlight on mouse over as a default Focus Behaviour?  following snippet and the screenshot attached is just an example to demonstrate the issue with the focusable property where even with focusable false category1 can be selected and highlighted.



    <telerik:RadTreeView x:Name="radTreeView">
                                <telerik:RadTreeViewItem Header="Category1" Focusable="False">
                                    <telerik:RadTreeViewItem Header="Product1" Focusable="True" />
                                    <telerik:RadTreeViewItem Header="Product2" />
                                    <telerik:RadTreeViewItem Header="Product3" />
                                <telerik:RadTreeViewItem Header="Category2" Focusable="False" />
                                <telerik:RadTreeViewItem Header="Category3" />
                                <telerik:RadTreeViewItem Header="Category4" Focusable="False">
                                    <telerik:RadTreeViewItem Header="Product A" Focusable="True" />
                                    <telerik:RadTreeViewItem Header="Product B" />
                                    <telerik:RadTreeViewItem Header="Product C" />
                                <telerik:RadTreeViewItem Header="Category5" />
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 24 Jul 2013 Link to this post

    Hi Jawad,

    The RadTreeView selection logic cannot be controlled via the Focusable property. With this property you can disable the Focused visual state of the items but not the selected state.

    In order to deny a RadTreeViewItem selection you have to:
    • either bind its IsSelected property and through your ViewModels logic evaluate its value and make sure it doesn't get set to True until the previous steps are implemented
    • or handle the PreviewSelectionChanged event every time that the previous steps aren't implemented. As soon as the Handled property of the event args of the event is set to True, the selection operation is reverted.

    If you can elaborate further on your original implementation or send over a sample that demonstrates your original approach, we can modify it (prepare a new sample) to demonstrate one or both of the suggested approaches.

    Tina Stancheva
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top