title: WPF: UserControl.IsFocused will not set
body: <p>I created a WPF UserControl, that handles all <code>GotFocus</code>/<code>LostFocus</code> events of its child controls. I call the <code>OnGotFocus</code>/<code>OnLostFocus</code> of the <code>UserControl</code>, but the <code>IsFocused</code> property of the UserControl will not set:</p>
  
  <pre><code>void MyUserControl_Initialized(object sender, EventArgs e)
  {
      foreach (UIElement control in (Content as Panel).Children)
      {
          control.LostFocus += control_LostFocus;
          control.GotFocus += control_GotFocus;
      }
  }
  
  void control_GotFocus(object sender, RoutedEventArgs e)
  {
      if (!IsFocused)
      {
          e.Handled = false;
          OnGotFocus(e);
      }
  }
  
  void control_LostFocus(object sender, RoutedEventArgs e)
  {
      bool hasAnythingTheFocus = false;
  
      foreach (UIElement control in (Content as Panel).Children)
      {
          if (control.IsFocused)
          {
              hasAnythingTheFocus = true;
          }
      }
  
      if (!hasAnythingTheFocus)
      {
          OnLostFocus(e);
      }
  }
  </code></pre>
  
  <p>How can I set it?</p>