title: How to set logical focus without giving keyboard focus?
body: <p>How can I in code define the logical focus of a container, or focused child, <strong>WITHOUT</strong> giving it keyboard focus ?  </p>
  
  <p>I just want to control which child will get the focus when the control will get focus through Tab key or clicking on part of the container that does not hit a child, but not give it (or steal) actual focus if it doesn't already have it.</p>
  
  <p>And I also want that selecting a specific child through a keyboard gesture or clicking on it with the mouse is still possible.</p>
  
  <p>I understand the difference in WPF between Keyboard Focus and Logical Focus, and the fact that for an element, having Keyboard Focus implies also having logical focus, but having logical focus does not imply that the element have keyboard focus. </p>
  
  <p>I also understand attached property FocusManager.FocusedElement defines which element has logical focus in the visual tree starting at the element defining this property.  </p>
  
  <p>I’ve realized that this property is not used only when FocusManager.IsFocusScope is set to true, but also for containers such as <strong>GroupBox</strong>.</p>
  
  <p>I’ve made many attempts, tons of searches and reading on WPF focus topic, but with no success so far, I don't understand what I'm missing:
  <Li>Calling <code>FocusManager.SetFocusedElement</code> also give keyboard focus, and it I temporarily change the property Focusable of my child element to false just before, it only works the very first time when no child had focus before, but not after a child got focus
  </Li>
  <Li>Handling events <strong>GotKeyboardFocus</strong> and <strong>PreviewGotKeyboardFocus</strong> at element or container to override initial focused element doesn’t work either, since I cannot tell whether the focus was obtained through the mouse or the keyboard, and whether focus got directly set to a child element or indirectly through the container.
  </Li></p>
  
  <p>An example to illustrate what I’m trying to achieve: I’ve a simple group of RadioButtons, and I want to control dynamically in code which option will get focus when user will “tab” to move focus to this GroupBox (typically the option that has <code>isChecked=true</code>).</p>
  
  <pre><code>&lt;GroupBox Header="Options" Name="myGroupBox"
            KeyboardNavigation.TabNavigation="Once" 
            KeyboardNavigation. DirectionalNavigation="Cycle" &gt;
      &lt;StackPanel&gt;
          &lt;RadioButton GroupName="g1" Name="opt1" Content="Option _1"/&gt;
          &lt;RadioButton GroupName="g1" Name="opt2" Content="Option _2"/&gt;
          &lt;RadioButton GroupName="g1" Name="opt3" Content="Option _3"/&gt;
      &lt;/StackPanel&gt;
  &lt;/GroupBox&gt;
  </code></pre>
  
  <p>A final comment, I know how to implement a dynamic list of options using a <strong>ListBox</strong>, binding <strong>selectedItem</strong> of the list to a property of the data context, and then through styles and templates on <strong>ListBoxItem</strong> bind <strong>IsChecked</strong> property of the <strong>RadioButton</strong> in item template to <strong>IsSelcted</strong> property of its parent <strong>ListBoxItem</strong>, and it works, but for my specific case, I need to keep my <strong>RadioButtons</strong> directly bound to properties of my data context, I can’t bind them to IsSelected property of the list at the same time.</p>