void OnSelectedItemChanging(TreeNodeChangingRoutedEventArgs routedEventArgs) { RaiseEvent(routedEventArgs); ExtTreeNode node = routedEventArgs.ChangedNode as ExtTreeNode; if (node != null) { node.ContextMenu = MenuService.CreateContextMenu(node, node.ContextmenuAddinTreePath); } }
public int CompareTo(object obj) { ExtTreeNode extTreeNode = obj as ExtTreeNode; if (extTreeNode == null) { TreeNode treeNode = obj as TreeNode; return(string.Compare(this.CompareString, treeNode.Header.ToString(), StringComparison.CurrentCulture)); } return(string.Compare(this.CompareString, extTreeNode.CompareString, StringComparison.CurrentCulture)); }
protected override void OnMouseDoubleClick(MouseButtonEventArgs e) { base.OnMouseDoubleClick(e); ExtTreeNode node = e.Source as ExtTreeNode; if (node != null) { node.ActivateItem(); node.SetEditMode(); } }
void DeleteNode(ExtTreeNode node) { if (node == null) { return; } if (node.EnableDelete) { node.Visibility = Visibility.Visible; node.IsSelected = true; node.Delete(); } }
protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e) { base.OnKeyDown(e); if (e.Key == Key.Enter) { ExtTreeNode node = SelectedItem as ExtTreeNode; if (node != null) { node.ActivateItem(); } } if (e.Key == Key.F2) { ExtTreeNode node = SelectedItem as ExtTreeNode; if (node != null) { node.SetEditMode(); } } }
public virtual void UpdateVisibility() { for (int i = 0; i < invisibleNodes.Count;) { if (invisibleNodes[i].Visible) { invisibleNodes[i].AddTo(this); invisibleNodes.RemoveAt(i); continue; } ++i; } foreach (TreeNode node in Items) { if (node is ExtTreeNode) { ExtTreeNode extTreeNode = (ExtTreeNode)node; if (!extTreeNode.Visible) { invisibleNodes.Add(extTreeNode); } } } foreach (TreeNode node in invisibleNodes) { Items.Remove(node); } foreach (TreeNode node in Items) { if (node is ExtTreeNode) { ((ExtTreeNode)node).UpdateVisibility(); } } }