コード例 #1
0
        // Token: 0x06005925 RID: 22821 RVA: 0x0018A2E0 File Offset: 0x001884E0
        private bool AllowHandleKeyEvent(FocusNavigationDirection direction)
        {
            if (!this.IsSelected)
            {
                return(false);
            }
            DependencyObject dependencyObject = Keyboard.FocusedElement as DependencyObject;

            if (dependencyObject != null)
            {
                DependencyObject dependencyObject2 = UIElementHelper.PredictFocus(dependencyObject, direction);
                if (dependencyObject2 != dependencyObject)
                {
                    while (dependencyObject2 != null)
                    {
                        TreeViewItem treeViewItem = dependencyObject2 as TreeViewItem;
                        if (treeViewItem == this)
                        {
                            return(false);
                        }
                        if (treeViewItem != null || dependencyObject2 is TreeView)
                        {
                            return(true);
                        }
                        dependencyObject2 = KeyboardNavigation.GetParent(dependencyObject2);
                    }
                }
            }
            return(true);
        }
コード例 #2
0
        private bool AllowHandleKeyEvent(FocusNavigationDirection direction)
        {
            if (!IsSelected)
            {
                return(false);
            }

            DependencyObject currentFocus = Keyboard.FocusedElement as DependencyObject;

            if (currentFocus != null)
            {
                DependencyObject predict = UIElementHelper.PredictFocus(currentFocus, direction);
                if (predict != currentFocus)
                {
                    while (predict != null)
                    {
                        TreeViewItem item = predict as TreeViewItem;
                        if (item == this)
                        {
                            return(false); // There is a focusable item in the header
                        }
                        else if ((item != null) || (predict is TreeView))
                        {
                            return(true);
                        }

                        predict = KeyboardNavigation.GetParent(predict);
                    }
                }
            }

            return(true);
        }