diff options
Diffstat (limited to 'Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView2.xaml.cs')
| -rw-r--r-- | Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView2.xaml.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView2.xaml.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView2.xaml.cs index 27251851c..5e4509beb 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView2.xaml.cs +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView2.xaml.cs @@ -57,5 +57,37 @@ namespace Tango.Scripting.IDE { MessageBox.Show("I am here"); } + private void TreeViewControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) + { + + IProject SelectedItem = SolutionTree.SelectedItem as IProject; + if(SelectedItem != null && DataContext is ScriptIDEViewVM && ((ScriptIDEViewVM)DataContext).IsSolutionProject(SelectedItem)) + { + SolutionTree.ContextMenu = SolutionTree.Resources["SolutionContext"] as System.Windows.Controls.ContextMenu; + } + else + { + SolutionTree.ContextMenu = SolutionTree.Resources["FolderContext"] as System.Windows.Controls.ContextMenu; + } + } + + private void SolutionTree_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) + { + TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); + + if (treeViewItem != null) + { + //treeViewItem.Focus(); + treeViewItem.IsSelected = true; + e.Handled = true; + } + } + static TreeViewItem VisualUpwardSearch(DependencyObject source) + { + while (source != null && !(source is TreeViewItem)) + source = VisualTreeHelper.GetParent(source); + + return source as TreeViewItem; + } } } |
