int IIsolationHost.SelectNextControl(bool forward) { try { if (_select > 0) { return(1); } _select++; try { // The client was the target of select next control. It // has handed the search over to us and we continue from // here. We need to wrap to get the correct behavior. return(ControlUtil.GetRoot(this).SelectNextControl(this, forward, true, true, true) ? 0 : 1); } finally { _select--; } } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
protected override void Select(bool directed, bool forward) { if (_select > 0) { return; } _select++; try { // We were the target of select next control. Forward the // call to the isolation client which does its search. If it // matches a control, we need to make ourselves active. if (ErrorUtil.ThrowOnFailure(_client.SelectNextControl(!directed || forward))) { base.Select(directed, forward); return; } // If the client wasn't able to select something, we continue the // search from here. One small detail is that SelectNextControl // does not match itself. When it would match an IsolationClient, // this would mean that the search does not go into the // IsolationHost. We specifically match this case by first doing // a non-wrapping search and matching the root for IsolationClient. // If that matches, we allow the IsolationClient to continue // the search upwards. Otherwise, we continue the search // from the root as usual. var root = ControlUtil.GetRoot(this); if (root.SelectNextControl(this, !directed || forward, true, true, !(root is IsolationClient))) { return; } if (root is IsolationClient) { Stubs.ControlSelect(root, directed, forward); } } finally { _select--; } }
protected IsolationHost() { SetStyle(ControlStyles.Selectable, true); _designMode = ControlUtil.GetIsInDesignMode(this); }