title: Windows Phone 8.1 XAML App. How to prevent inappropriate automatic focus change?
body: <p>Imagine the following simple page markup:</p>
  
  <pre><code>&lt;Page
      x:Class="AutoFocusBug.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  
      &lt;StackPanel&gt;
          &lt;!--&lt;Button x:Name="FocusHolder" Width="0" Height="0" MinHeight="0" MinWidth="0"/&gt;--&gt;
          &lt;TextBox Text="zxczczczczx"/&gt;
          &lt;Button x:Name="Button1" Content="Button1" Click="ButtonBase_OnClick"/&gt;
      &lt;/StackPanel&gt;
  &lt;/Page&gt;
  </code></pre>
  
  <p>and the following code-behind:</p>
  
  <pre><code>private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
  {
      Button1.Visibility = Visibility.Collapsed;
  }
  </code></pre>
  
  <p>When I click <code>Button1</code> button it hides (which is expected and desired) but for some reason <code>TextBox</code> automatically gets focus and on-screen keyboard appears. I don't want this unexpected auto-focus. </p>
  
  <p>I can try to do something with focus in <code>Click</code> handler but in real app it is implemented with ViewModel with commands and so on and it looks like dirty hack (and also keyboard appears for short period even if I change focus immediately after hiding button).</p>
  
  <p>The second approach I found is to create "invisible" button somewhere before the textbox (commented <code>FocusHolder</code>) which is quite better but also doesn't look like correct technique.</p>
  
  <p>So, what is that? Is this some mechanism that I can somehow configure to "redirect" focus from collapsed element? Or is it a bug? What is the right way to prevent this undesired auto-focus?</p>