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

How do I attach a context menu to a TreeViewItem?

1 Answer 797 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Grant asked on 14 Sep 2020, 02:49 PM

Hi, 

I would like to display a context menu (similar to https://www.telerik.com/kendo-react-ui/components/layout/menu/context-menu/) when I right click on an item in a TreeView (https://www.telerik.com/kendo-react-ui/components/treeview/). The context menu should be aware of the relevant TreeViewItem that was right clicked on e.g. so I can perform an edit or delete. Is this possible?

Thanks, 
Grant

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 Sep 2020, 11:53 AM

Hello, Grant,

This can be done by using the TreeView items custom rendering to attach and onContextMenu event over them and dynamically show a Popup component with a Menu over the item:

https://www.telerik.com/kendo-react-ui/components/treeview/custom-rendering/

I have also attached a project that showcases this.

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Stefan
Telerik team
Share this question
or