Hello Krati Chauhan,
In order to run the project you will need to set the 284486_TreeViewEmptyDisableContextMenu.Web
as a StartUp Project
and the 284486_TreeViewEmptyDisableContextMenuTestPage.aspx
as a Start Page
Also, I may have not understood your scenario correctly. Here is what I tried to do:
I access all selected items, using the SelectedItems
collection of the RadTreeView
in the OnMenuItemClicked()
event handler, in order to highlight them (since my ContextMenu
items are all called Highlight :) ).
In the RadContextMenu Opened()
event handler I add the right clicked item to the RadTreeView SelectedItems
collection if no other item is selected on a mouse right click (according to the requirement to allow multiple selection only through left mouse click + Ctrl key).
RadTreeViewItem item = (sender as RadContextMenu).GetClickedElement<RadTreeViewItem>();
each time the context menu is opened (the right mouse button is clicked) I get the right clicked item and add it to the RadTreeView SelectedItems
(RightClickedItems.Count == 0)
collection is initially empty:
public ObservableCollection<RadTreeViewItem> RightClickedItems = new ObservableCollection<RadTreeViewItem>();
and it represents the list of items selected on a mouse right click.
If this collection contains items (RightClickedItems.Count != 0)
they are removed from the RadTreeView SelectedItems
collection(RightClickedItem.IsSelected = false),
then the new right clicked item is selected and the RightClickedItems
collection is cleared, thus allowing only one item to be selected on a mouse right click. This is according to the requirement " When a user right clicks on node 'X' and then right clicks on node 'Y', the node 'X' should not be selected." and "2. The node on which the context menu was opened should be selected as well."
Please let me know if this is what your scenario requires or if you need another approach.
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Public Issue Tracking
system and vote to affect the priority of the items.