From 4a9fb8a89a7fc48d9d3ecc9f24770c472834453d Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 7 Apr 2019 16:14:48 +0300 Subject: added code to launch dynamically dialogs during run time, correct styles treeview item --- .../Tango.Scripting.IDE/ScriptIDEView2.xaml.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView2.xaml.cs') 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 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; + } } } -- cgit v1.3.1