This is a migrated thread and some comments may be shown as answers.

Selected and current(?) item mismatch after mouse selection

2 Answers 42 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 15 Oct 2014, 01:46 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 20 Oct 2014, 08:49 AM
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.

 
0
Marcin
Top achievements
Rank 1
answered on 20 Oct 2014, 11:12 AM
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


Tags
TreeView
Asked by
Marcin
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Marcin
Top achievements
Rank 1
Share this question
or