Esempio n. 1
0
 private SharpTreeViewTextSearch(SharpTreeView treeView)
 {
     if (treeView == null)
     {
         throw new ArgumentNullException(nameof(treeView));
     }
     this.treeView = treeView;
     inputStack    = new Stack <string>(8);
     ClearState();
 }
Esempio n. 2
0
        public static SharpTreeViewTextSearch GetInstance(SharpTreeView sharpTreeView)
        {
            var textSearch = (SharpTreeViewTextSearch)sharpTreeView.GetValue(TextSearchInstanceProperty);

            if (textSearch == null)
            {
                textSearch = new SharpTreeViewTextSearch(sharpTreeView);
                sharpTreeView.SetValue(TextSearchInstanceProperty, textSearch);
            }
            return(textSearch);
        }
Esempio n. 3
0
        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));
            }
        }
Esempio n. 4
0
        static void HandleCanExecute_Delete(object sender, CanExecuteRoutedEventArgs e)
        {
            SharpTreeView treeView = (SharpTreeView)sender;

            e.CanExecute = treeView.GetTopLevelSelection().All(node => node.CanDelete());
        }
Esempio n. 5
0
 public UpdateLock(SharpTreeView instance)
 {
     this.instance = instance;
     this.instance.updatesLocked = true;
 }