title: Textbox Enter Key event not working in WPF
body: <p>The keydown event is not working properly.  I want to raise the same event as the button when the enter key is pressed.  Here is the c#   </p>
  
  <pre><code>    public partial class Search : Control
      {
          public SearchRevision()
          {
              InitializeComponent();
          }
  
  
          private void Button_Click_1(object sender, RoutedEventArgs e)
          {
              SearchViewModel vm = this.DataContext as SearchViewModel;
              if (vm != null)
                  vm.Refresh();
          }
  
          private void myTextBox_KeyDown(Object sender, KeyEventArgs e)
          {
              if (e.Key == Key.Enter)
              {
                  SearchViewModel vm = this.DataContext as SearchViewModel;
                  if (vm != null)
                      vm.Refresh();
              }
          }
  
          private void myTextBox_Escape(Object sender, KeyEventArgs e)
          {
              if (e.Key == Key.Escape)
              {
                  txtName.Text = "";
              }
          }
      }
  </code></pre>