title: WPF - Why isn't Keyboard.Focus() working?
body: <p>have a TextBox item (MyTextBox) on a TabItem control. I have code that looks as follows:</p>
  
  <pre><code>MyTextBox.Focus();
  Keyboard.Focus(MyTextBox);
  </code></pre>
  
  <p>When I run this code through the debugger I see the following after the lines are executed:</p>
  
  <pre><code>MyTextBox.IsFocused = true
  MyTextBox.IsKeyboardFocused = false
  </code></pre>
  
  <p>Can anyone tell me why the textbox isn't receiving keyboard focus? It's just a standard TextBox control that is enabled.</p>