private void CheckBox_Checked(object sender, RoutedEventArgs e) { var nodeCb = e.Source as CheckBox; var node = nodeCb?.DataContext as TreeNode; if (node == null) { return; } SelectedNode = node; SelectedNodes.Add(SelectedNode); if (node is FolderNode) { foreach (var item in SelectedNode.Descendents) { if (!item.IsSelected) { item.IsSelected = true; SelectedNodes.Add(item); } } } SelectedCount = SelectedNodes.Count(); }
void DetermineSelection() { Rect r = new Rect(selectionRect.Margin.Left, selectionRect.Margin.Top, selectionRect.Width, selectionRect.Height); int count = 0; foreach (UINode n in GraphNodes) { if (n.IsInRect(r)) { if (SelectedNodes.Contains(n)) { SelectedNodes.Remove(n); n.HideBorder(); } else { SelectedNodes.Add(n); n.ShowBorder(); } count++; } } if (count == 0) { ClearMultiSelect(); } }
public bool SelectNode(TreeNode node, bool select, TreeViewAction action) { if (node == null || IsNodeSelected(node) == select) { return(false); } TreeViewCancelEventArgs ce = new TreeViewCancelEventArgs(node, false, action); SuspendBeforeSelect = true; OnBeforeSelect(ce); SuspendBeforeSelect = false; if (ce.Cancel) { return(false); } if (select) { node.EnsureVisible(); SelectedNodes.Add(node); } else { SelectedNodes.Remove(node); } OnAfterSelect(new TreeViewEventArgs(node, action)); return(true); }
public void Add_Null_NoImpact() { var s = new SelectedNodes(); s.Add(null); Assert.AreEqual(0, s.Count); }
private void NodeControl_HeaderMouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Released || Keyboard.IsKeyDown(Key.Space)) { return; } NodeControl nodeControl = sender as NodeControl; ContentPresenter contentPresenter = VisualTreeHelper.GetParent(nodeControl) as ContentPresenter; Canvas canvas = VisualTreeHelper.GetParent(contentPresenter) as Canvas; contentPresenter.SetValue(Panel.ZIndexProperty, currentZIndex++); if (!SelectedNodes.Contains(nodeControl.NodeInfo)) { if (Keyboard.IsKeyUp(Key.LeftCtrl) && Keyboard.IsKeyUp(Key.RightCtrl) && Keyboard.IsKeyUp(Key.LeftShift) && Keyboard.IsKeyUp(Key.RightShift)) { SelectedNodes.Clear(); } SelectedNodes.Add(nodeControl.NodeInfo); } movingNodeOrigins = SelectedNodes.Select(n => nodeControls[n]).ToDictionary(n => n, n => movingNodeOrigins.ContainsKey(n) ? movingNodeOrigins[n] : null); movingNodeOffsets = SelectedNodes.Select(n => nodeControls[n]).ToDictionary(n => n, n => movingNodeOffsets.ContainsKey(n) ? movingNodeOffsets[n] : null); foreach (NodeControl n in movingNodeOrigins.Keys.ToArray()) { movingNodeOrigins[n] = new Point(n.NodeInfo.X, n.NodeInfo.Y); movingNodeOffsets[n] = e.GetPosition(n); } }
private void BuildSelectedNodesMenu() { SelectedNodes.Clear(); if (Presentation == null) { return; } var transformations = Presentation.GetModule <ITransformationModule>(); var captions = Presentation.GetModule <ICaptionModule>(); var selections = Presentation.GetPropertySetFor <Selection>(); var nodes = transformations.Graph.Nodes .Union(Presentation.Graph.Nodes) .Where(n => selections.TryGet(n.Id)?.IsSelected ?? false) .Distinct() .Select(n => new NodeWithCaption(n, captions.Get(n.Id).DisplayText)) .OrderBy(n => n.DisplayText); foreach (var n in nodes) { SelectedNodes.Add(n); } mySelectionMenuUpdatePending = false; }
private async void CheckBox_Checked(object sender, RoutedEventArgs e) { var nodeCb = e.Source as CheckBox; var node = nodeCb?.DataContext as TreeNode; if (node == null) { return; } SelectedNode = node; SelectedNodes.Add(SelectedNode); if (node is FolderNode) { await Task.Run(() => { foreach (var item in node.Descendents.Where(p => !p.IsSelected)) { item.IsSelected = true; var del = new TreeNodeDelegate(AddSelectedNode); App.Current.Dispatcher.Invoke(del, item); } }); } UpdateCount(); }
public void Add_Null_NoImpact() { var s = new SelectedNodes(); s.Add(null); Assert.AreEqual(0, s.Count); }
private void HandleDrop() { if (!AllowMoveNodes) { return; } var dropNode = _dropNode; if (dropNode == null) { StopDrag(); return; } if (ForceDropToParent(dropNode)) { dropNode = dropNode.ParentNode; } if (CanMoveNodes(_dragNodes, dropNode, true)) { var cachedSelectedNodes = SelectedNodes.ToList(); MoveNodes(_dragNodes, dropNode); foreach (var node in _dragNodes) { if (node.ParentNode == null) { Nodes.Remove(node); } else { node.ParentNode.Nodes.Remove(node); } dropNode.Nodes.Add(node); } if (TreeViewNodeSorter != null) { dropNode.Nodes.Sort(TreeViewNodeSorter); } dropNode.Expanded = true; NodesMoved(_dragNodes); foreach (var node in cachedSelectedNodes) { SelectedNodes.Add(node); } } StopDrag(); UpdateNodes(); }
public void AddNode(Node child, double x, double y, bool addedByBrain = false) { AddChildren(child); SetLeft(child, x); SetTop(child, y); Nodes.Add(child); SelectedNodes.Clear(); SelectedNodes.Add(child); }
public void SelectNode(TreeNode node) { SelectedNodes.Clear(); SelectedNodes.Add(node); _anchoredNodeStart = node; _anchoredNodeEnd = node; Invalidate(); }
protected override void OnShapePicked(Node node) { if (SelectedNodes.Count > 0 && SelectedNodes[0].Index == node.Index) { return; } SelectShape(node); SelectedNodes.Add(node); UpdateShapeSelection(); }
public void SelectElement(BaseElement el) { SelectedElements.Add(el); if (el is NodeElement) { SelectedNodes.Add(el); } if (_canFireEvents) OnElementSelection(this, new ElementSelectionEventArgs(SelectedElements)); }
/// <summary> /// select the specified node /// </summary> public void Select(Node node) { node.Selected = true; if (node.HasMesh) { node.GameObject.GetComponent <Renderer>().material = new Material(HighlightMaterial); } //if (!SelectedNodes.Contains(node)) SelectedNodes.Add(node); }
public void SelectElements(Rectangle selectionRectangle) { SelectedElements.EnabledCalc = false; SelectedNodes.EnabledCalc = false; // Add all "hitable" elements foreach (BaseElement element in Elements) { if (!(element is IControllable)) { continue; } var ctrl = ((IControllable)element).GetController(); if (!ctrl.HitTest(selectionRectangle)) { continue; } if (!(element is ConnectorElement)) { SelectedElements.Add(element); } if (element is NodeElement) { SelectedNodes.Add(element); } } //if the seleciont isn't a expecific link, remove links // without 2 elements in selection if (SelectedElements.Count > 1) { foreach (BaseElement el in Elements) { var lnk = el as BaseLinkElement; if (lnk == null) { continue; } if ((!SelectedElements.Contains(lnk.Connector1.ParentElement)) || (!SelectedElements.Contains(lnk.Connector2.ParentElement))) { SelectedElements.Remove(lnk); } } } SelectedElements.EnabledCalc = true; SelectedNodes.EnabledCalc = true; OnElementSelection(this, new ElementSelectionEventArgs(SelectedElements)); }
public void ToggleMultiSelect(UINode n) { if (SelectedNodes.Contains(n)) { SelectedNodes.Remove(n); n.HideBorder(); } else { SelectedNodes.Add(n); n.ShowBorder(); } }
public void SelectNode(TreeNodeMS node, bool select) { if (!select) { SelectedNodes.Remove(node); } else if (!node.IsInSelection) { SelectedNodes.Add(node); // Make sure all ancestors of this node are expanded for (var parent = node.Parent; parent != null && !parent.IsExpanded; parent = parent.Parent) { parent.Expand(); } } node.IsInSelection = select; }
public void SelectNodes(List <TreeNode> nodes, bool updateAnchors = true) { SelectedNodes.Clear(); foreach (var node in nodes) { SelectedNodes.Add(node); } if (updateAnchors && SelectedNodes.Count > 0) { _anchoredNodeStart = SelectedNodes[SelectedNodes.Count - 1]; _anchoredNodeEnd = SelectedNodes[SelectedNodes.Count - 1]; } Invalidate(); }
/// <summary> /// Calculate the nodes and noodles that fall within the selction area /// </summary> /// <param name="IsClick">true if the user clicked without dragging</param> private void UpdateSelected(bool IsClick) { SelectedNoodles.Clear(); //hit test Nodes if it wasn't just a click if (_allNodes != null) { foreach (DaggerUINode node in _allNodes) { if (!IsClick) { Rectangle noderect = new Rectangle(node.Location, node.Size); if (_parent is ScrollableControl) { // modify noderect to account for scrollbar positions noderect.Offset((_parent as ScrollableControl).AutoScrollPosition.X * -1, (_parent as ScrollableControl).AutoScrollPosition.Y * -1); } if (noderect.IntersectsWith(SelectionArea)) { SelectedNodes.Add((IDaggerUINode)node); } } } } //hit test Noodles foreach (DaggerNoodle noodle in _allNoodles) { //get the points from the noodle path PointF[] pathpoints = noodle.path.PathPoints; //check each segment to see if it intersects with the selction area for (int i = 0; i < pathpoints.Length - 1; i++) { if (lineRectangleIntersection(SelectionArea, pathpoints[i], pathpoints[i + 1])) { SelectedNoodles.Add(noodle); break; } } } }
public void AddSelectedNode(Node node) { node.IsSelected = true; SelectedNodes.Add(node); if (SelectedEdgePart != null) { SelectedEdgePart.IsSelected = false; } if (SelectedEdgeBreak != null) { SelectedEdgeBreak.IsSelected = false; } SelectedEdgePart = null; SelectedEdgeBreak = null; SelectionChanged(); }
public void SelectAllElements() { SelectedElements.EnabledCalc = false; SelectedNodes.EnabledCalc = false; foreach(BaseElement element in Elements) { if (!(element is ConnectorElement)) SelectedElements.Add(element); if (element is NodeElement) SelectedNodes.Add(element); } SelectedElements.EnabledCalc = true; SelectedNodes.EnabledCalc = true; }
private void OnMouseUp(object sender, MouseButtonEventArgs mouseButtonEventArgs) { if (MouseMode == MouseMode.SelectionRectangle && Children.Contains(_selectionZone)) { Children.Remove(_selectionZone); SelectedNodes.Clear(); for (var index = 0; index < Nodes.Count; index++) { var node = Nodes[index]; if (node.IsSelected) { SelectedNodes.Add(node); } } MouseMode = MouseMode.Nothing; } if (MouseMode == MouseMode.ResizingComment) { TempComment.Cursor = Cursors.Arrow; TempComment = null; } HideLinkingPossiblity(); Cursor = Cursors.Arrow; if (WireMode == WireMode.FirstPortSelected && (TemExecPort != null || TemObjectPort != null)) { NodesTree.Show(); MouseMode = MouseMode.Nothing; WireMode = WireMode.Nothing; } else { Children.Remove(TempConn); MouseMode = MouseMode.Nothing; WireMode = WireMode.Nothing; } _mouseEffect.Show(this, Colors.DarkGray); Task.Factory.StartNew(() => { Thread.Sleep(300); Application.Current.Dispatcher.BeginInvoke(new Action(() => { _mouseEffect.Remove(this); })); }); }
/// <summary> /// Raises the <see cref="TreeView.AfterSelect"/> event. /// </summary> /// <remarks> /// This handles the selection and unselection of nodes. /// </remarks> /// <param name="e">A <see cref="TreeViewEventArgs"/> describing the event arguments.</param> protected override void OnAfterSelect(TreeViewEventArgs e) { if (MultiSelect) { if (((ModifierKeys & Keys.Control) > 0)) { if (!SelectedNodes.Contains(e.Node)) { SelectedNodes.Add(e.Node); } else { SelectedNodes.Remove(e.Node); } } else { if (((ModifierKeys & Keys.Shift) > 0) && (m_tndFirst != null)) { SelectedNodes.Clear(); SelectedNodes.AddRange(FindPath(m_tndFirst, e.Node)); } else { if (SelectedNodes.Count > 0) { SelectedNodes.Clear(); } SelectedNodes.Add(e.Node); } } } base.OnAfterSelect(e); if (!MultiSelect) { if (!SelectedNodes.Contains(e.Node)) { SelectedNodes.Clear(); SelectedNodes.Add(e.Node); } } }
/// <summary> /// select the specified node /// </summary> public void Select(Node node) { if (node.Locked) { return; } node.Selected = true; if (node.HasMesh) { node.GameObject.GetComponent <Renderer>().material = new Material(HighlightMaterial); } if (!SelectedNodes.Contains(node)) { SelectedNodes.Add(node); } if (OnSelectEvent != null) { OnSelectEvent.Invoke(node); } }
private void SelectActions() { _hoverNode = MouseOverNode(); _hoverPort = MouseOverPort(); if (_hoverNode != null) { if (!SelectedNodes.Contains(_hoverNode)) { SelectedNodes.Clear(); SelectedNodes.Add(_hoverNode); } Event.current.Use(); } else if (_hoverPort != null) { Event.current.Use(); } else { SelectedNodes.Clear(); } }
public bool SelectMultipleItemsForMove() { int count = ChildNodes.Count(n => n.IsMultiSelected); if (count < 1) { return(false); } SelectedNodes.Clear(); foreach (var node in ChildNodes.Where(n => n.IsMultiSelected)) { node.DisplayMode = NodeDisplayMode.SelectedForCopyOrMove; SelectedNodes.Add(node); } this.IsMultiSelectActive = false; this.PreviousDisplayMode = this.CurrentDisplayMode; this.CurrentDisplayMode = DriveDisplayMode.CopyOrMoveItem; return(true); }
public void Select(PhraseNode node) { SelectedNodes.Add(node); }
private void HandleMouseMove(object sender, MouseEventArgs e) { if (MouseMode == MouseModes.Selection) { if (e.LeftButton == MouseButtonState.Pressed) { if (selectionRectangle == null) { selectionRectangle = new Border { // Move to WPF style Background = Brushes.Transparent, BorderBrush = new SolidColorBrush(Application.Current.Resources["ColorBlue"] is Color ? (Color)Application.Current.Resources["ColorBlue"] : new Color()), CornerRadius = new CornerRadius(5), BorderThickness = new Thickness(2) }; SetLeft(selectionRectangle, startSelectionPoint.X); SetTop(selectionRectangle, startSelectionPoint.Y); Children.Add(selectionRectangle); } var currentPosition = Mouse.GetPosition(this); var delta = Point.Subtract(currentPosition, startSelectionPoint); if (delta.X < 0) { SetLeft(selectionRectangle, currentPosition.X); } if (delta.Y < 0) { SetTop(selectionRectangle, currentPosition.Y); } selectionRectangle.Width = Math.Abs(delta.X); selectionRectangle.Height = Math.Abs(delta.Y); foreach (var node in NodeCollection) { SelectedNodes.Remove(node); if ((node.Left >= GetLeft(selectionRectangle) && node.Left + node.ActualWidth <= GetLeft(selectionRectangle) + selectionRectangle.Width) && (node.Top >= GetTop(selectionRectangle) && node.Top + node.ActualHeight <= GetTop(selectionRectangle) + selectionRectangle.Height)) { node.IsSelected = true; SelectedNodes.Add(node); } else { node.IsSelected = false; } } } } switch (SplineMode) { case SplineModes.Nothing: ClearTempLine(); break; case SplineModes.First: break; case SplineModes.Second: if (TempLine == null) { TempLine = new Line { Style = FindResource("VplLineStyle") as Style }; Children.Add(TempLine); } TempLine.X1 = TempStartPort.Origin.X; TempLine.Y1 = TempStartPort.Origin.Y; TempLine.X2 = Mouse.GetPosition(this).X; TempLine.Y2 = Mouse.GetPosition(this).Y; break; default: throw new ArgumentOutOfRangeException(); } }
public void GoForNode(Node node) { node.X = Math.Truncate(node.X); node.Y = Math.Truncate(node.Y); var origin = BasisOrigin; origin.X -= node.ActualWidth - 10; origin.X = Math.Truncate(origin.X); origin.Y = Math.Truncate(origin.Y); var difference = Point.Subtract(origin, new Point(node.X, node.Y)); var timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 01) }; foreach (var n in Nodes) { if (difference.X < 0) { n.X += difference.X; } else { n.X += difference.X; } if (difference.Y < 0) { n.Y += difference.Y; } else { n.Y += difference.Y; } NeedsRefresh = true; } difference.X = 10; difference.Y = 0; if (difference.X != 0 || difference.Y != 0) { timer.Start(); } timer.Tick += (s, e) => { if (difference.X == 0 && difference.Y == 0) { timer.Stop(); } foreach (var n in Nodes) { if (difference.X > 0) { n.X++; } else { n.X--; } if (difference.Y > 0) { n.Y++; } else { n.Y--; } } if (difference.X > 0) { difference.X--; } else { difference.X++; } if (difference.Y > 0) { difference.Y--; } else { difference.Y++; } }; SelectedNodes.Clear(); SelectedNodes.Add(node); }
/* * public void DoDynamicAnimation(object sender, MouseButtonEventArgs args) * { * for (var i = 0; i < 36; ++i) * { * // var e = new Button { Width = 50, Height = 16, Content="Test" }; * * //var e = new Ellipse { Width = 16, Height = 16, Fill = SystemColors.HighlightBrush }; * //var e = new Ellipse { Width = 6, Height = 6, Fill=Brushes.HotPink }; * * var e = new SliderNode(this) {Left = Mouse.GetPosition(this).X, Top = Mouse.GetPosition(this).Y}; * * // var e = new TextBlock { Text = "Test" }; * // var e = new Slider { Width = 100 }; * * // var e = new ProgressBar { Width = 100 , Height =10, Value=i }; * * // var e = =new DataGrid{Width=100, Height=100}; * // var e = new TextBox { Text = "Hallo" }; * // var e = new Label { Content = "Halllo" }; * // var e = new RadioButton { Content="dfsdf" }; * * //Canvas.SetLeft(e, Mouse.GetPosition(this).X); * //Canvas.SetTop(e, Mouse.GetPosition(this).Y); * * var tg = new TransformGroup(); * var translation = new TranslateTransform(30, 0); * var translationName = "myTranslation" + translation.GetHashCode(); * RegisterName(translationName, translation); * tg.Children.Add(translation); * tg.Children.Add(new RotateTransform(i*10)); * e.RenderTransform = tg; * * NodeCollection.Add(e); * Children.Add(e); * * var anim = new DoubleAnimation(3, 250, new Duration(new TimeSpan(0, 0, 0, 2, 0))) * { * EasingFunction = new PowerEase {EasingMode = EasingMode.EaseOut} * }; * * var s = new Storyboard(); * Storyboard.SetTargetName(s, translationName); * Storyboard.SetTargetProperty(s, new PropertyPath(TranslateTransform.YProperty)); * var storyboardName = "s" + s.GetHashCode(); * Resources.Add(storyboardName, s); * * s.Children.Add(anim); * * s.Completed += * (sndr, evtArgs) => * { * //panel.Children.Remove(e); * Resources.Remove(storyboardName); * UnregisterName(translationName); * }; * s.Begin(); * } * } */ public void VplControl_KeyUp(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Delete: foreach (var node in SelectedNodes) { node.Delete(); } SelectedNodes.Clear(); break; case Key.C: { if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { tempCollection = new TrulyObservableCollection <Node>(); foreach (var node in SelectedNodes) { tempCollection.Add(node); } } } break; case Key.V: { if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { if (tempCollection == null) { return; } if (tempCollection.Count == 0) { return; } var bBox = Node.GetBoundingBoxOfNodes(tempCollection.ToList()); var copyPoint = new Point(bBox.Left + bBox.Size.Width / 2, bBox.Top + bBox.Size.Height / 2); var pastePoint = Mouse.GetPosition(this); var delta = Point.Subtract(pastePoint, copyPoint); SelectedNodes.Clear(); var alreadyClonedConnectors = new List <Connector>(); var copyConnections = new List <CopyConnection>(); // copy nodes from clipboard to canvas foreach (var node in tempCollection) { var newNode = node.Clone(); newNode.Left += delta.X; newNode.Top += delta.Y; newNode.Left = Convert.ToInt32(newNode.Left); newNode.Top = Convert.ToInt32(newNode.Top); NodeCollection.Add(newNode); copyConnections.Add(new CopyConnection { NewNode = newNode, OldNode = node }); } foreach (var cc in copyConnections) { var counter = 0; foreach (var conn in cc.OldNode.InputPorts) { foreach (var connector in conn.ConnectedConnectors) { if (!alreadyClonedConnectors.Contains(connector)) { Connector newConnector = null; // start and end node are contained in selection if (tempCollection.Contains(connector.StartPort.ParentNode)) { var cc2 = copyConnections.FirstOrDefault( i => Equals(i.OldNode, connector.StartPort.ParentNode)); if (cc2 != null) { newConnector = new Connector(this, cc2.NewNode.OutputPorts[0], cc.NewNode.InputPorts[counter]); } } // only end node is contained in selection else { newConnector = new Connector(this, connector.StartPort, cc.NewNode.InputPorts[counter]); } if (newConnector != null) { alreadyClonedConnectors.Add(connector); ConnectorCollection.Add(newConnector); } } } counter++; } } } } break; case Key.G: { if (Keyboard.Modifiers == ModifierKeys.Control) { GroupNodes(); } } break; case Key.S: { if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { SaveFile(); } } break; case Key.O: { if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { OpenFile(); } } break; case Key.A: { if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { SelectedNodes.Clear(); foreach (var node in NodeCollection) { node.IsSelected = true; SelectedNodes.Add(node); } } } break; } }
private void OnKeyDown(object sender, KeyEventArgs keyEventArgs) { switch (keyEventArgs.Key) { case Key.Down: for (var index = 0; index < SelectedNodes.Count; index++) { var node = SelectedNodes[index]; node.Y = node.Y + 5; node.Focus(); } break; case Key.Up: for (var index = 0; index < SelectedNodes.Count; index++) { var node = SelectedNodes[index]; node.Y = node.Y - 5; node.Focus(); } break; case Key.Left: for (var index = 0; index < SelectedNodes.Count; index++) { var node = SelectedNodes[index]; node.X = node.X - 5; node.Focus(); } break; case Key.Right: for (var index = 0; index < SelectedNodes.Count; index++) { var node = SelectedNodes[index]; node.X = node.X + 5; node.Focus(); } break; case Key.Delete: if (SelectedNodes.Contains(RootNode)) { SelectedNodes.Remove(RootNode); } for (var index = 0; index < SelectedNodes.Count; index++) { var node = SelectedNodes[index]; Nodes.Remove(node); if (node.IsCollapsed == false) { node.Delete(); } } break; case Key.C: if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.LeftShift)) { //This code is still under exp //var collapsedRegion = new NodesContainer(this, SelectedNodes.ToList()); } if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { Copy(); } break; case Key.V: if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { Paste(); } break; case Key.Subtract: if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { ZoomOut(); keyEventArgs.Handled = true; } break; case Key.Add: if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { ZoomIn(); keyEventArgs.Handled = true; } break; case Key.A: SelectedNodes.Clear(); if (Keyboard.FocusedElement is Node) { if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { if (Nodes != null) { for (var index = 0; index < Nodes.Count; index++) { var node = Nodes[index]; node.Focus(); SelectedNodes.Add(node); } } } } break; case Key.F: if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { SearchForm.Show(); } break; case Key.X: if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { Copy(); DeleteSelected(); } break; case Key.Escape: if (Keyboard.FocusedElement is Node) { if (SelectedNodes.Count != 0) { for (var index = 0; index < SelectedNodes.Count; index++) { var node = SelectedNodes[index]; node.IsSelected = false; } SelectedNodes.Clear(); } } break; } }