Selected and current(?) item mismatch after mouse selection

3 posts, 1 answers
  1. Marcin
    Marcin avatar
    31 posts
    Member since:
    Jul 2013

    Posted 15 Oct 2014 Link to this post

    Hi,

    our users reported us an disadvantage while using tree view with mouse and keyboard. The problem is, that after performing mouse selections, the user cannot use right/left arrows to expand/collapse the item. Everything starts working just after moving with keyboard up and down - then everything works fine until another mouse selection.

    The problem is, that in some scenarios, after changing the selected item with mouse, the current item indicator (the line around the item on the attached screen) stays on the previously selected item. 

    It can be easily reproduced on 'clear' (not self-styled) tree, when selecting first child elem, and then moving the selection with mouse to its parent.

    However, in our production application the problem is a little different and it occurs between each selection change and in our scenario the current item indicator seems to be lost totally, and left/right arrows clicks are bubbled to the tree itself causing the horizontal scroll viewer being scrolled. Second 'click' on the already selected item moves the current item indicator (the additional light border around the item) - and after that left/right arrows start working as intended.

    The questions is: is there any easy way to make the tree view item got the 'current item indicator' just after clicking item once? Is there something wrong with our templates? Styles? That we loose totally a current item after each mouse-selection?

    Best regards
    Marcin




  2. Answer
    Martin
    Admin
    Martin avatar
    1101 posts

    Posted 20 Oct 2014 Link to this post

    Hello Marcin,

    The reported behavior with the border of the previously selected item is a known issue in RadTreeView. You can find it logged in our feedback portal where you can track its status and vote. If you follow the feedback item you will be notified by email as soon as there is any progress on the issue.

    To work this around you can subscribe for the SelectionChanged event of RadTreeView and inside its handler focus the actual selected item. Here is an example in code:

    private void RadTreeView_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
    {
        if (e.AddedItems.Count > 0)
        {
            var selectedItem = e.AddedItems[0] as RadTreeViewItem;
            if (selectedItem != null)
            {
                selectedItem.Focus();
            }
        }
    }

    As for the behavior in your project, I cannot be sure what is causing it without your implementation. Can you please provide me with a sample project with your code and the modified styles? However, the forum doesn't allow attaching .zip files, so you can open new Support Ticket and refer this forum or describe the issue again. 

    Thank you for any help you can provide.

    Regards,
    Martin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Marcin
    Marcin avatar
    31 posts
    Member since:
    Jul 2013

    Posted 20 Oct 2014 in reply to Martin Link to this post

    Hello Martin,

    Thank you for your response.

    For now Your solution works, so I'll wait until the bug reported in your feedback portal is closed. Maybe this will also fix the bug in our applications.

    Best regards
    Marcin


Back to Top