title: right way to stop keydown event from bubble up
body: <p>Here I have window which need to handle different keys in keydown event. When Enter is pressed popup with textbox emerges and text typed into this textbox SHOULD NOT raise window keydown event.</p>
  
  <pre><code>&lt;Window x:Class="PopupTest.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:PopupTest"
      mc:Ignorable="d"
      Title="MainWindow"
      Height="350"
      Width="525"
      KeyDown="Window_KeyDown"  &gt;
  &lt;Grid&gt;
      &lt;Popup Name="symbolPopup"
             Grid.Row="0"
             Placement="RelativePoint"
             IsOpen="False"&gt;
          &lt;TextBox Width="70" x:Name="symbolTextBox"
                   KeyDown="symbolTextBox_KeyDown"
                   Background="#FFFFDF18" /&gt;
  
      &lt;/Popup&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>Code behind:</p>
  
  <pre><code>    private void Window_KeyDown(object sender, KeyEventArgs e)
      {
          switch (e.Key)
          {
              case Key.Enter:
                  {
                      symbolPopup.IsOpen = true;
                      symbolTextBox.Focus();
                      break;
                  }
              default:
                  break;
          }
      }
  
      private void symbolTextBox_KeyDown(object sender, KeyEventArgs e)
      {
          if (e.Key == Key.Enter)
          {
              symbolPopup.IsOpen = false;
              string name = symbolTextBox.Text;
              symbolTextBox.Text = null;
              e.Handled = true;
              MessageBox.Show(name + " assigned");
          }
          // e.Handled = true;
      }
  </code></pre>
  
  <p>I don't need window keydown event to fire while popup is opened. If I uncomment //e.Handled = true textbox wouldn't get any text at all. I know I can solve this by checking if popup is open in the body of window keydown handler, but my question is how can I stop keydown to buble up from textbox and same time making textbox get what user types?</p>