RobotStudio event

Create ContextMenu of WpfTreeView

Hi everybody.
I want to build some sort of browser window using the WpfTreeView. My problem now is, that I wnat to add a ContextMenu (Right click) to the Items, just like the Menus in e.g. the Layout browser. I added a context menu in the .xaml of the usercontrol, but I want to show the ContextMenu only on the childnodes of my rootnode.

So how can I add the Menu only to the childnodes and not to the whole treeview?

<div><rs:WpfTreeView.ContextMenu></div><div>&nbsp; <ContextMenu Background="WhiteSmoke"></div><div>&nbsp; &nbsp; <MenuItem Header="Remove" Click="ContextMenuRemove_Click"/></div><div>&nbsp; </ContextMenu></div><div></rs:WpfTreeView.ContextMenu></div>

Best Answer

Answers

  • Okay. Just thought their would be a better or more elegant way than that. But than I will make it like this. Thank you.