Is there a way to specify in a TreeView‘s HierarchicalDataTemplate to use a different ContextMenu depending on a property on the data an item is bound to?
For instance, display one ContextMenu if Item.IsFile is true, display a different one if Item.IsFolder is true, etc.
This is example for ListBox, I think you can easily modify it to work with TreeView.
XAML:
Code: