In XAML, how do you define a context menu for treeviewitems that are distinguished by different attributes?
private void SolutionTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs e) { TreeViewItem SelectedItem = SolutionTree.SelectedItem as TreeViewItem; switch (SelectedItem.Tag.ToString()) { case "Solution": SolutionTree.ContextMenu = SolutionTree.Resources["SolutionContext"] as System.Windows.Controls.ContextMenu; break; case "Folder": SolutionTree.ContextMenu = SolutionTree.Resources["FolderContext"] as System.Windows.Controls.ContextMenu; break; } }