public void SelectCurrentBySpace()
        {
            TreeViewExItem item = GetFocusedItem();

            SelectSingleItem(item);
            PresentationHelper.ForceFocus(item);
        }
        internal override void OnMouseDown(MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);

            _ItemForDeferredSelection = null;

            TreeViewExItem item = GetTreeViewItemUnderMouse(e.GetPosition(treeViewEx));

            if (item == null)
            {
                return;
            }
            if (e.ChangedButton != MouseButton.Left && !(e.ChangedButton == MouseButton.Right && item.ContextMenu != null))
            {
                return;
            }
            if (item.IsEditing)
            {
                return;
            }

            // Do not select on MouseDown if part of the selection list
            // To enable drag'n'drop, this selction is done in MouseUp
            if (treeViewEx.SelectedItems.Count > 1 && item.IsSelected)
            {
                _ItemForDeferredSelection = item;
                return;
            }

            SelectSingleItem(item);

            PresentationHelper.ForceFocus(item);
        }
        public void SelectLast()
        {
            TreeViewExItem item = TreeViewElementFinder.FindLast(treeViewEx, true);

            if (item != null)
            {
                SelectSingleItem(item);
            }

            PresentationHelper.ForceFocus(item);
        }
Esempio n. 4
0
        internal bool StopEditing()
        {
            if (_EditedItem == null)
            {
                return(false);
            }

            Keyboard.Focus(_EditedItem);
            _EditedItem.IsEditing = false;
            PresentationHelper.ForceFocus(_EditedItem);
            _EditedItem = null;
            return(true);
        }
        public void SelectNextFromKey()
        {
            TreeViewExItem item = GetFocusedItem();

            item = TreeViewElementFinder.FindNext(item, true);
            if (item == null)
            {
                return;
            }

            // if ctrl is pressed just focus it, so it can be selected by space. Otherwise select it.
            if (!IsControlKeyDown)
            {
                SelectSingleItem(item);
            }

            PresentationHelper.ForceFocus(item);
        }
        public void SelectPreviousFromKey()
        {
            List <TreeViewExItem> items = TreeViewElementFinder.FindAll(treeViewEx, true).ToList();
            TreeViewExItem        item  = GetFocusedItem();

            item = treeViewEx.GetPreviousItem(item, items);
            if (item == null)
            {
                return;
            }

            // if ctrl is pressed just focus it, so it can be selected by space. Otherwise select it.
            if (!IsControlKeyDown)
            {
                SelectSingleItem(item);
            }

            PresentationHelper.ForceFocus(item);
        }
        public void SelectFromUiAutomation(TreeViewExItem item)
        {
            SelectSingleItem(item);

            PresentationHelper.ForceFocus(item);
        }
 private void OnTreeViewExEditTextBoxLoaded(object sender, RoutedEventArgs e)
 {
     GetBindingExpression(TextProperty)?.UpdateTarget();
     PresentationHelper.ForceFocus(this);
 }