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
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.
<
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>
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.
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.
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
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.
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
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.