Exemplo n.º 1
0
        protected override void OnKeyUp(KeyEventArgs e)
        {
            base.OnKeyUp(e);
            if (!e.Handled)
            {
                Key key = e.Key;
                switch (key)
                {
                case Key.Left:
                case Key.Right:
                case Key.Up:
                case Key.Down:
                case Key.Add:
                case Key.Subtract:
                case Key.Space:
                    IEnumerable <TreeViewExItem> items = TreeViewElementFinder.FindAll(ParentTreeView, false);
                    TreeViewExItem focusedItem         = items.FirstOrDefault(x => x.IsFocused);

                    if (focusedItem != null)
                    {
                        focusedItem.BringIntoView(new Rect(1, 1, 1, 1));
                    }

                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void BringIntoView(object item)
        {
            UpdateLayout();
            TreeViewExItem tvei = GetTreeViewItemFor(item);

            tvei.BringIntoView();
        }