How to right-click a treeview item on a uielement editorwindow

Hello!

I’m making a editorwindow. I’ve been trying select a certain treeviewitem to show a simple context menu when the user right-clicks by uielement treeview class.

But I found that I can’t select a mouse-pointed treeviewitem by right-click on treeview.

How can I do? Thank anyone for their help.

ps. I don’t want to use the IMGUI Treeview class. (It worked prefectly)

@andrew-lukasik
Thanks for your reply, but it is not what I want to ask.

Maybe I am still not clear enough. So I make a demo. Let’s to look these 2 pics:

In IMGUI, when i right-click a treeview item, it will be activated.

But in uielement, when I right-click, the mouse-pointed item will not be activated.

This is what I want to ask.

Is this kind of contextual menu you are looking for?

if you take a look at the documentation for TreeView you can find the methods called SetSelection and SetSelectionById.
You can call one of those methods in your callback code whenever you show your contextmenu to set the “activated” item.