public TreeViewImpl(ITreeViewManager treeViewManager, IThemeManager themeManager, IImageManager imageManager, Guid guid, TreeViewOptions options) { this.guid = guid; this.treeViewManager = treeViewManager; this.imageManager = imageManager; this.treeViewListener = options.TreeViewListener; this.sharpTreeView = new SharpTreeView(); this.sharpTreeView.SelectionChanged += SharpTreeView_SelectionChanged; this.sharpTreeView.CanDragAndDrop = options.CanDragAndDrop; this.sharpTreeView.AllowDrop = options.AllowDrop; this.sharpTreeView.AllowDropOrder = options.AllowDrop; VirtualizingStackPanel.SetIsVirtualizing(this.sharpTreeView, options.IsVirtualizing); VirtualizingStackPanel.SetVirtualizationMode(this.sharpTreeView, options.VirtualizationMode); this.sharpTreeView.SelectionMode = options.SelectionMode; this.sharpTreeView.BorderThickness = new Thickness(0); this.sharpTreeView.ShowRoot = false; this.sharpTreeView.ShowLines = false; if (options.IsGridView) { this.sharpTreeView.ItemContainerStyle = (Style)Application.Current.FindResource(SharpGridView.ItemContainerStyleKey); this.sharpTreeView.Style = (Style)Application.Current.FindResource("SharpTreeViewGridViewStyle"); } else { // Clear the value set by the constructor. This is required or our style won't be used. this.sharpTreeView.ClearValue(ItemsControl.ItemContainerStyleProperty); this.sharpTreeView.Style = (Style)Application.Current.FindResource(typeof(SharpTreeView)); } this.sharpTreeView.GetPreviewInsideTextBackground = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlight).Background; this.sharpTreeView.GetPreviewInsideForeground = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlightText).Foreground; // Add the root at the end since Create() requires some stuff to have been initialized this.root = Create(options.RootNode ?? new TreeNodeDataImpl(new Guid(FileTVConstants.ROOT_NODE_GUID))); this.sharpTreeView.Root = this.root.Node; }
/// <summary> /// Enables extensible context menu support for the specified tree view. /// </summary> public static void Add(SharpTreeView treeView) { var provider = new ContextMenuProvider(treeView); treeView.ContextMenuOpening += provider.treeView_ContextMenuOpening; // Context menu is shown only when the ContextMenu property is not null before the // ContextMenuOpening event handler is called. treeView.ContextMenu = new ContextMenu(); }
static void HandleCanExecute_Delete(object sender, CanExecuteRoutedEventArgs e) { SharpTreeView treeView = (SharpTreeView)sender; var nodes = treeView.GetTopLevelSelection().ToArray(); e.CanExecute = nodes.Length > 0 && nodes[0].CanDelete(nodes); e.Handled = true; }
static void HandleExecuted_Delete(object sender, ExecutedRoutedEventArgs e) { SharpTreeView treeView = (SharpTreeView)sender; foreach (SharpTreeNode node in treeView.GetTopLevelSelection().ToArray()) { node.Delete(); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.inform = ((ICSharpCode.CodeQuality.Gui.NodeDescription)(target)); return; case 2: this.topTree = ((ICSharpCode.TreeView.SharpTreeView)(target)); #line 46 "..\..\..\..\Gui\DependencyMatrixView.xaml" this.topTree.MouseMove += new System.Windows.Input.MouseEventHandler(this.TopTreeMouseMove); #line default #line hidden #line 47 "..\..\..\..\Gui\DependencyMatrixView.xaml" this.topTree.AddHandler(System.Windows.Controls.ScrollViewer.ScrollChangedEvent, new System.Windows.Controls.ScrollChangedEventHandler(this.ViewScrollChanged)); #line default #line hidden return; case 3: this.leftTree = ((ICSharpCode.TreeView.SharpTreeView)(target)); #line 73 "..\..\..\..\Gui\DependencyMatrixView.xaml" this.leftTree.MouseMove += new System.Windows.Input.MouseEventHandler(this.LeftTreeMouseMove); #line default #line hidden #line 74 "..\..\..\..\Gui\DependencyMatrixView.xaml" this.leftTree.AddHandler(System.Windows.Controls.ScrollViewer.ScrollChangedEvent, new System.Windows.Controls.ScrollChangedEventHandler(this.ViewScrollChanged)); #line default #line hidden return; case 4: this.scrollViewer = ((System.Windows.Controls.ScrollViewer)(target)); #line 82 "..\..\..\..\Gui\DependencyMatrixView.xaml" this.scrollViewer.ScrollChanged += new System.Windows.Controls.ScrollChangedEventHandler(this.ViewScrollChanged); #line default #line hidden return; case 5: this.matrix = ((ICSharpCode.CodeQuality.Gui.DependencyMatrixControl)(target)); return; } this._contentLoaded = true; }
private SharpTreeViewTextSearch(SharpTreeView treeView) { if (treeView == null) { throw new ArgumentNullException(nameof(treeView)); } this.treeView = treeView; inputStack = new Stack <string>(8); ClearState(); }
public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null) { var reference = textView != null ? textView.GetReferenceSegmentAtMousePosition() : null; var selectedTreeNodes = treeView != null ? treeView.GetTopLevelSelection().ToArray() : null; return new TextViewContext { TreeView = treeView, SelectedTreeNodes = selectedTreeNodes, TextView = textView, Reference = reference }; }
static void HandleExecuted_Delete(object sender, ExecutedRoutedEventArgs e) { e.Handled = true; SharpTreeView treeView = (SharpTreeView)sender; var nodes = treeView.GetTopLevelSelection().ToArray(); if (nodes.Length > 0) { nodes[0].Delete(nodes); } }
public static SharpTreeViewTextSearch GetInstance(SharpTreeView sharpTreeView) { var textSearch = (SharpTreeViewTextSearch)sharpTreeView.GetValue(TextSearchInstanceProperty); if (textSearch == null) { textSearch = new SharpTreeViewTextSearch(sharpTreeView); sharpTreeView.SetValue(TextSearchInstancePropertyKey, textSearch); } return(textSearch); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 12 "..\..\..\..\Src\Refactoring\SearchForIssuesDialog.xaml" ((CSharpBinding.Refactoring.SearchForIssuesDialog)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden return; case 2: this.searchInRBG = ((ICSharpCode.SharpDevelop.Widgets.RadioButtonGroup)(target)); return; case 3: this.treeView = ((ICSharpCode.TreeView.SharpTreeView)(target)); return; case 4: this.fixCheckBox = ((System.Windows.Controls.CheckBox)(target)); #line 32 "..\..\..\..\Src\Refactoring\SearchForIssuesDialog.xaml" this.fixCheckBox.Checked += new System.Windows.RoutedEventHandler(this.FixCheckBox_Checked); #line default #line hidden #line 32 "..\..\..\..\Src\Refactoring\SearchForIssuesDialog.xaml" this.fixCheckBox.Unchecked += new System.Windows.RoutedEventHandler(this.FixCheckBox_Unchecked); #line default #line hidden return; case 5: this.searchButton = ((System.Windows.Controls.Button)(target)); #line 35 "..\..\..\..\Src\Refactoring\SearchForIssuesDialog.xaml" this.searchButton.Click += new System.Windows.RoutedEventHandler(this.searchButton_Click); #line default #line hidden return; } this._contentLoaded = true; }
static void HandleExecuted_Paste(object sender, ExecutedRoutedEventArgs e) { SharpTreeView treeView = (SharpTreeView)sender; var data = Clipboard.GetDataObject(); if (data != null) { var selectedNode = (treeView.SelectedItem as SharpTreeNode) ?? treeView.Root; if (selectedNode != null) { selectedNode.Paste(data); } } e.Handled = true; }
public LocalVarPad() { var res = new CommonResources(); res.InitializeComponent(); tree = new SharpTreeView(); tree.Root = new SharpTreeNode(); tree.ShowRoot = false; tree.View = (GridView)res["variableGridView"]; tree.ItemContainerStyle = (Style)res["itemContainerStyle"]; tree.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "50%;25%;25%"); WindowsDebugger.RefreshingPads += RefreshPad; RefreshPad(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.treeView = ((ICSharpCode.TreeView.SharpTreeView)(target)); #line 10 "..\..\XamlOutlineContentHost.xaml" this.treeView.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.TreeViewMouseDoubleClick); #line default #line hidden return; } this._contentLoaded = true; }
static void HandleCanExecute_Paste(object sender, CanExecuteRoutedEventArgs e) { SharpTreeView treeView = (SharpTreeView)sender; var data = Clipboard.GetDataObject(); if (data == null) { e.CanExecute = false; } else { var selectedNode = (treeView.SelectedItem as SharpTreeNode) ?? treeView.Root; e.CanExecute = selectedNode != null && selectedNode.CanPaste(data); } e.Handled = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 2: this.myList = ((ICSharpCode.TreeView.SharpTreeView)(target)); #line 54 "..\..\..\..\Pads\Controls\WatchList.xaml" this.myList.PreviewMouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.MyListPreviewMouseDoubleClick); #line default #line hidden return; } this._contentLoaded = true; }
public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null, ListBox listBox = null) { ReferenceSegment reference; if (textView != null) reference = textView.GetReferenceSegmentAtMousePosition(); else if (listBox != null) reference = new ReferenceSegment { Reference = ((SearchResult)listBox.SelectedItem).Member }; else reference = null; var position = textView != null ? textView.GetPositionFromMousePosition() : null; var selectedTreeNodes = treeView != null ? treeView.GetTopLevelSelection().ToArray() : null; return new TextViewContext { TreeView = treeView, SelectedTreeNodes = selectedTreeNodes, TextView = textView, Reference = reference, Position = position }; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 30 "..\..\..\Src\AnalysisProjectOptionsPanel.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeRuleAssembliesButtonClick); #line default #line hidden return; case 2: this.ruleTreeView = ((ICSharpCode.TreeView.SharpTreeView)(target)); return; } this._contentLoaded = true; }
static void HandleExecuted_Delete(object sender, ExecutedRoutedEventArgs e) { SharpTreeView treeView = (SharpTreeView)sender; treeView.updatesLocked = true; int selectedIndex = -1; try { foreach (SharpTreeNode node in treeView.GetTopLevelSelection().ToArray()) { if (selectedIndex == -1) { selectedIndex = treeView.flattener.IndexOf(node); } node.Delete(); } } finally { treeView.updatesLocked = false; treeView.UpdateFocusedNode(null, Math.Max(0, selectedIndex - 1)); } }
public TreeViewImpl(ITreeViewServiceImpl treeViewService, IThemeService themeService, IClassificationFormatMapService classificationFormatMapService, Guid guid, TreeViewOptions options) { Guid = guid; this.treeViewService = treeViewService; treeViewListener = options.TreeViewListener; classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged; foregroundBrushResourceKey = options.ForegroundBrushResourceKey ?? "TreeViewForeground"; sharpTreeView = new SharpTreeView(); sharpTreeView.SelectionChanged += SharpTreeView_SelectionChanged; sharpTreeView.CanDragAndDrop = options.CanDragAndDrop; sharpTreeView.AllowDrop = options.AllowDrop; sharpTreeView.AllowDropOrder = options.AllowDrop; VirtualizingStackPanel.SetIsVirtualizing(sharpTreeView, options.IsVirtualizing); VirtualizingStackPanel.SetVirtualizationMode(sharpTreeView, options.VirtualizationMode); sharpTreeView.SelectionMode = options.SelectionMode; sharpTreeView.BorderThickness = new Thickness(0); sharpTreeView.ShowRoot = false; sharpTreeView.ShowLines = false; if (options.IsGridView) { sharpTreeView.SetResourceReference(ItemsControl.ItemContainerStyleProperty, SharpGridView.ItemContainerStyleKey); sharpTreeView.SetResourceReference(FrameworkElement.StyleProperty, "SharpTreeViewGridViewStyle"); } else { // Clear the value set by the constructor. This is required or our style won't be used. sharpTreeView.ClearValue(ItemsControl.ItemContainerStyleProperty); sharpTreeView.SetResourceReference(FrameworkElement.StyleProperty, typeof(SharpTreeView)); } sharpTreeView.GetPreviewInsideTextBackground = () => themeService.Theme.GetColor(ColorType.SystemColorsHighlight).Background; sharpTreeView.GetPreviewInsideForeground = () => themeService.Theme.GetColor(ColorType.SystemColorsHighlightText).Foreground; // Add the root at the end since Create() requires some stuff to have been initialized root = Create(options.RootNode ?? new TreeNodeDataImpl(new Guid(DocumentTreeViewConstants.ROOT_NODE_GUID))); sharpTreeView.Root = root.Node; }
/// <summary> /// Enables extensible context menu support for the specified tree view. /// </summary> public static void Add(SharpTreeView treeView) { var provider = new ContextMenuProvider(treeView); treeView.ContextMenuOpening += provider.treeView_ContextMenuOpening; treeView.ContextMenuClosing -= provider.treeView_ContextMenuClosing; }
internal SharpTreeViewAutomationPeer(SharpTreeView owner ) : base(owner) { }
static void InitializeTreeView(SharpTreeView treeView) { treeView.GetPreviewInsideTextBackground = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlight).Background; treeView.GetPreviewInsideForeground = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlightText).Foreground; }
/// <summary> /// TreeView助手 /// </summary> /// <param name="TreeView"></param> public TreeViewHelper(SharpTreeView TreeView) { _TreeView = TreeView; }
internal static void InitializeTreeView(SharpTreeView treeView) { // Clear the value set by the constructor. This is required or our style won't be used. treeView.ClearValue(ItemsControl.ItemContainerStyleProperty); treeView.GetPreviewInsideTextBackground = () => Themes.Theme.GetColor(ColorType.SystemColorsHighlight).InheritedColor.Background.GetBrush(null); treeView.GetPreviewInsideForeground = () => Themes.Theme.GetColor(ColorType.SystemColorsHighlightText).InheritedColor.Foreground.GetBrush(null); }
internal static void InitializeAssemblyTreeView(SharpTreeView treeView) { InitializeTreeView(treeView); VirtualizingStackPanel.SetIsVirtualizing(treeView, true); // VirtualizationMode.Recycling results in slower scrolling but less memory usage. // In my simple test, 225MB vs 280MB (165 loaded assemblies, selected method was // [mscorlib]System.String::Format(string, object), scroll up and down, release, then // keep doing it a number of times). // VirtualizationMode.Standard: all created items are freed once the scrolling stops // which can sometimes result in the UI not responding to input. Doesn't seem to be a // problem with the treeview, though. More of a problem with the CIL editor which has // to use Recycling. // SharpTreeView defaults to Recycling, so we must explicitly set it to Standard. VirtualizingStackPanel.SetVirtualizationMode(treeView, VirtualizationMode.Standard); }
static void HandleCanExecute_Delete(object sender, CanExecuteRoutedEventArgs e) { SharpTreeView treeView = (SharpTreeView)sender; e.CanExecute = treeView.GetTopLevelSelection().All(node => node.CanDelete()); }
internal static void InitializeTreeView(SharpTreeView treeView, bool isGridView = false) { if (isGridView) treeView.ItemContainerStyle = (Style)App.Current.TryFindResource(SharpGridView.ItemContainerStyleKey); else { // Clear the value set by the constructor. This is required or our style won't be used. treeView.ClearValue(ItemsControl.ItemContainerStyleProperty); } treeView.GetPreviewInsideTextBackground = () => Themes.Theme.GetColor(ColorType.SystemColorsHighlight).InheritedColor.Background.GetBrush(null); treeView.GetPreviewInsideForeground = () => Themes.Theme.GetColor(ColorType.SystemColorsHighlightText).InheritedColor.Foreground.GetBrush(null); }
ContextMenuProvider(SharpTreeView treeView, DecompilerTextView textView = null) { this.treeView = treeView; this.textView = textView; App.CompositionContainer.ComposeParts(this); }
internal SharpTreeViewAutomationPeer(SharpTreeView owner) : base(owner) { }
private ContextMenuProvider(SharpTreeView treeView) { this.treeView = treeView; App.CompositionContainer.ComposeParts(this); }
public UpdateLock(SharpTreeView instance) { this.instance = instance; this.instance.updatesLocked = true; }
internal static void InitializeAssemblyTreeView(SharpTreeView treeView) { InitializeTreeView(treeView); VirtualizingStackPanel.SetIsVirtualizing(treeView, true); // With new optimization, Recycling mode is better. VirtualizingStackPanel.SetVirtualizationMode(treeView, VirtualizationMode.Recycling); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 23 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OpenCommandExecuted); #line default #line hidden return; case 2: #line 26 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.RefreshCommandExecuted); #line default #line hidden return; case 3: #line 29 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.SaveCommandExecuted); #line default #line hidden return; case 4: #line 32 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.BackCommandCanExecute); #line default #line hidden #line 33 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.BackCommandExecuted); #line default #line hidden return; case 5: #line 36 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.ForwardCommandCanExecute); #line default #line hidden #line 37 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.ForwardCommandExecuted); #line default #line hidden return; case 6: #line 40 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.SearchCommandExecuted); #line default #line hidden return; case 7: this.mainMenu = ((System.Windows.Controls.Menu)(target)); return; case 8: this.toolBar = ((System.Windows.Controls.ToolBar)(target)); return; case 9: this.languageComboBox = ((System.Windows.Controls.ComboBox)(target)); return; case 10: this.statusBar = ((System.Windows.Controls.Primitives.StatusBar)(target)); return; case 11: this.StatusLabel = ((System.Windows.Controls.TextBlock)(target)); return; case 12: this.leftColumn = ((System.Windows.Controls.ColumnDefinition)(target)); return; case 13: this.rightColumn = ((System.Windows.Controls.ColumnDefinition)(target)); return; case 14: this.treeView = ((ICSharpCode.TreeView.SharpTreeView)(target)); #line 113 "..\..\..\MainWindow.xaml" this.treeView.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TreeView_SelectionChanged); #line default #line hidden return; case 15: this.topPaneRow = ((System.Windows.Controls.RowDefinition)(target)); return; case 16: this.textViewRow = ((System.Windows.Controls.RowDefinition)(target)); return; case 17: this.bottomPaneRow = ((System.Windows.Controls.RowDefinition)(target)); return; case 18: this.updateAvailablePanel = ((System.Windows.Controls.Border)(target)); return; case 19: #line 142 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.updateAvailablePanelCloseButtonClick); #line default #line hidden return; case 20: #line 145 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.downloadUpdateButtonClick); #line default #line hidden return; case 21: this.topPane = ((ICSharpCode.ILSpy.Controls.DockedPane)(target)); return; case 22: this.mainPane = ((System.Windows.Controls.ContentPresenter)(target)); return; case 23: this.bottomPane = ((ICSharpCode.ILSpy.Controls.DockedPane)(target)); return; } this._contentLoaded = true; }
internal static void InitializeTreeView(SharpTreeView treeView) { // Clear the value set by the constructor. This is required or our style won't be used. treeView.ClearValue(ItemsControl.ItemContainerStyleProperty); treeView.GetPreviewInsideTextBackground = () => Themes.Theme.GetColor(dntheme.ColorType.SystemColorsHighlight).InheritedColor.Background.GetBrush(null); treeView.GetPreviewInsideForeground = () => Themes.Theme.GetColor(dntheme.ColorType.SystemColorsHighlightText).InheritedColor.Foreground.GetBrush(null); VirtualizingStackPanel.SetIsVirtualizing(treeView, true); // VirtualizationMode.Recycling results in slower scrolling but less memory usage. // In my simple test, 225MB vs 280MB (165 loaded assemblies, selected method was // [mscorlib]System.String::Format(string, object), scroll up and down, release, then // keep doing it a number of times). // VirtualizationMode.Standard: all created items are freed once the scrolling stops // which can sometimes result in the UI not responding to input. Doesn't seem to be a // problem with the treeview, though. More of a problem with the CIL editor which has // to use Recycling. // SharpTreeView defaults to Recycling, so we must explicitly set it to Standard. VirtualizingStackPanel.SetVirtualizationMode(treeView, VirtualizationMode.Standard); }