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

[Solved] Bug in treeview multiselection ContextMenu

9 Answers 169 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
shai
Top achievements
Rank 1
shai asked on 02 Apr 2009, 09:12 AM
Hi
When i  use multiselection property in the TreeView and i select some nodes
when i operate the context menu, i loose the selected nodes and i got only the node that operate the contextmenu.

thanx for your response
shai

9 Answers, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 02 Apr 2009, 10:24 AM
Hi shai,

Can you please send us a sample project that demonstrates the problem you encountered so that we can investigate?

Best wishes,
Tihomir Petkov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
shai
Top achievements
Rank 1
answered on 02 Apr 2009, 12:13 PM

<

 

UserControl x:Class="SilverlightApplication2.Page"

 

 

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

 

xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"

 

 

 

Width="400" Height="300">

 

 

 

 

<Grid x:Name="LayoutRoot" Background="White">

 

 

 

 

<telerik:RadTreeView Name="m_Tree" SelectionMode="Multiple" Height="400" Width="500" HorizontalAlignment="Left" VerticalAlignment="Top" IsLineEnabled="True" IsRootLinesEnabled="True">  

 

 

 

<telerik:RadContextMenu.ContextMenu>

 

 

<telerik:RadContextMenu x:Name="contextMenu" ModifierKey="Alt" EventName="MouseLeftButtonUp">

 

 

 

 

<telerik:RadMenuItem Header="Delete Item" />

 

 

 

 

<telerik:RadMenuItem Header="Edit" />

 

 

 

 

</telerik:RadContextMenu>

 

 

 

 

</telerik:RadContextMenu.ContextMenu>

 

 

 

 

<telerik:RadTreeViewItem Header="North">

 

 

 

 

<telerik:RadTreeViewItem Header="Region1">

 

 

 

 

<telerik:RadTreeViewItem Header="District1" >

 

 

 

 

<telerik:RadTreeViewItem Header="Dogs" />

 

 

 

 

<telerik:RadTreeViewItem Header="Officer" />

 

 

 

 

<telerik:RadTreeViewItem Header="Dogs" />

 

 

 

 

<telerik:RadTreeViewItem Header="Fireman"/>

 

 

 

 

</telerik:RadTreeViewItem>

 

 

 

 

</telerik:RadTreeViewItem>

 

 

 

</telerik:RadTreeViewItem>

 

 

</telerik:RadTreeView>

 

 

 

 

</Grid>

 

 

</

 

UserControl>

 

 

 

 

 

0
Tihomir Petkov
Telerik team
answered on 02 Apr 2009, 02:06 PM
Hi shai,

I am afraid the code snippet you sent is not enough - I need to take a look at what you are doing in the code-behind. So, can you please zip your entire test project and attach it to your reply so that I am able to see exactly what is going wrong?

Greetings,
Tihomir Petkov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
shai
Top achievements
Rank 1
answered on 03 Apr 2009, 12:57 PM
Hi Tihomir
There is no code behined
0
Tihomir Petkov
Telerik team
answered on 06 Apr 2009, 10:44 AM
Hi shai,

I am attaching an updated version of your project which, I hope, achieves what you want. I did not find any problems with the RadTreeView.SelectedItems collection. Let me know if you have further difficulties.

Sincerely yours,
Tihomir Petkov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
shai
Top achievements
Rank 1
answered on 06 Apr 2009, 11:12 AM
Hi
I will explain my problem again
But lets use my attachment without the code behined
the problem is when i select few nodes with left mouse button + Ctrl and i press Alt to show the Context menu 
When the Context menu has been shown, only one of the selected items is stayed selected.
Thanx
shai 
0
Tihomir Petkov
Telerik team
answered on 06 Apr 2009, 12:40 PM
Hello shai,

Sorry, I forgot about the modifier key. Currently there are certain issues with the way the context menu handles modifier keys. In the case of the Alt key, the browser is also listening for that key and the end result is that the treeview is unfocused and then focused again. This is the reason why in the end you have only the last item selected.

Doesn't the right-click context menu from the sample I sent you work for you?

Greetings,
Tihomir Petkov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
shai
Top achievements
Rank 1
answered on 06 Apr 2009, 02:25 PM

Hi
The right click menu cause a problems in japanese so we decided to usr the Shift or the Alt keys
But they made the selection problem

shai

0
Tihomir Petkov
Telerik team
answered on 06 Apr 2009, 02:52 PM
Hello shai,

Unfortuantely, there is currently no easy workaround for the modifier key issue. The Shift key is used by the treeview to select a range when multiple selection is allowed, so it also interferes with the correct functioning of the context menu when paired with a treeview.

Probably we can think of something that will work for you. What exactly is the problem with Japanese and right-click?

Best wishes,
Tihomir Petkov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
shai
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
shai
Top achievements
Rank 1
Share this question
or