コード例 #1
0
        public void SelectCurrentBySpace()
        {
            TreeViewExItem item = GetFocusedItem();

            SelectSingleItem(item);
            PresentationHelper.ForceFocus(item);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void SelectLast()
        {
            TreeViewExItem item = TreeViewElementFinder.FindLast(treeViewEx, true);

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

            PresentationHelper.ForceFocus(item);
        }
コード例 #4
0
ファイル: TreeViewEx.cs プロジェクト: lanicon/Macad3D
        internal bool StopEditing()
        {
            if (_EditedItem == null)
            {
                return(false);
            }

            Keyboard.Focus(_EditedItem);
            _EditedItem.IsEditing = false;
            PresentationHelper.ForceFocus(_EditedItem);
            _EditedItem = null;
            return(true);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public void SelectFromUiAutomation(TreeViewExItem item)
        {
            SelectSingleItem(item);

            PresentationHelper.ForceFocus(item);
        }
コード例 #8
0
 private void OnTreeViewExEditTextBoxLoaded(object sender, RoutedEventArgs e)
 {
     GetBindingExpression(TextProperty)?.UpdateTarget();
     PresentationHelper.ForceFocus(this);
 }