Hi,
My TreeView is bound to a ObservableCollection<TreeNode>. Using a HierarchicaldataTemplate the ItemSource is bound to my collection's TreeNodeChildren.
I want to bind a context meny to each node, and must do it in code as the context meny can be different for each node.
But how do I bind the contect menu to the node when the node is a TreeNode and not a RadTreeViewItem?
I cannot cast the current TreeNode to a RadTreeViewItem and hence cannot use the code:
myRadTreeViewItem.SetValue(RadContextMenu.ContextMenuProperty, contMenu);
as TreeNode doesn't have that functionality. I know how to bind properties, like isExpanded, between myTreeNode class and the TreeView, but how do I "bind" a command?
So in code I want to add a new TreeNode to my bound TreeNodeChildren collection, then dynamically create a new context menu and attach this context menu to my newly created TreNode. How do I do that?
Appreciate if somebody has an idea!
My TreeView is bound to a ObservableCollection<TreeNode>. Using a HierarchicaldataTemplate the ItemSource is bound to my collection's TreeNodeChildren.
I want to bind a context meny to each node, and must do it in code as the context meny can be different for each node.
But how do I bind the contect menu to the node when the node is a TreeNode and not a RadTreeViewItem?
I cannot cast the current TreeNode to a RadTreeViewItem and hence cannot use the code:
myRadTreeViewItem.SetValue(RadContextMenu.ContextMenuProperty, contMenu);
as TreeNode doesn't have that functionality. I know how to bind properties, like isExpanded, between myTreeNode class and the TreeView, but how do I "bind" a command?
So in code I want to add a new TreeNode to my bound TreeNodeChildren collection, then dynamically create a new context menu and attach this context menu to my newly created TreNode. How do I do that?
Appreciate if somebody has an idea!