In XAML, how do you define a context menu for treeviewitems that are distinguished by different attributes?
You could define the ContextMenus in several styles and select the style using a ItemContainerStyleSelector, based on those attributes.
ContextMenu
ItemContainerStyleSelector
Or you could directly specify an ItemContainerStyle and select the appropriate ContextMenu using triggers
ItemContainerStyle