Ejemplo n.º 1
0
        public void reparentIfNeeded(FocusNode node)
        {
            D.assert(node != null);
            if (node._parent == null || node._parent == this)
            {
                return;
            }

            node.unfocus();
            D.assert(node._parent == null);
            if (this._focus == null)
            {
                this._setFocus(node);
            }
        }
Ejemplo n.º 2
0
        public void detach()
        {
            D.assert(_node != null);
            D.assert(FocusManagerUtils._focusDebug("Detaching node:", new List <string> {
                _node.ToString(), $"With enclosing scope {_node.enclosingScope}"
            }));
            if (isAttached)
            {
                if (_node.hasPrimaryFocus || (_node._manager != null && _node._manager._markedForFocus == _node))
                {
                    _node.unfocus(disposition: UnfocusDisposition.previouslyFocusedChild);
                }

                _node._manager?._markDetached(_node);
                _node._parent?._removeChild(_node);
                _node._attachment = null;
                D.assert(!_node.hasPrimaryFocus);
                D.assert(_node._manager?._markedForFocus != _node);
            }
            D.assert(!isAttached);
        }