title: How to close SIP in WP7 User Control
body: <p>I have previously added a "close" button to a sip by setting InputScope to Search, handling the key up event and calling Focus if the Key is Enter.</p>
  
  <p>I tried to do the same thing in a user control containing a textblock and a textbox and the sip just won't close.</p>
  
  <p>Here is the user control:</p>
  
  <p>XAML</p>
  
  <pre><code>&lt;UserControl
  x:Class="SlidePanels.UserControls.TextBoxControl"
  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"
  mc:Ignorable="d"
  FontFamily="{StaticResource PhoneFontFamilyNormal}"
  FontSize="{StaticResource PhoneFontSizeNormal}"
  Foreground="{StaticResource PhoneForegroundBrush}"
  d:DesignWidth="480"&gt;
  
  &lt;StackPanel
      Orientation="Vertical"
      Background="{StaticResource PhoneChromeBrush}"&gt;
      &lt;TextBlock
          x:Name="LabelControl"
          Text="Label Control"
          Style="{StaticResource PhoneTextNormalStyle}" /&gt;
      &lt;TextBox
          x:Name="TextControl"
          Text="Text Control"
          InputScope="Search"
          KeyUp="TextControl_KeyUp" /&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>Code:</p>
  
  <pre><code>using System.Windows.Input;
  
  namespace SlidePanels.UserControls
  {
      public partial class TextBoxControl
      {
  
          public TextBoxControl()
          {
              InitializeComponent();
          }
  
          public string FieldName { get; set; }
  
          public string Label
          {
              set { LabelControl.Text = value; }
          }
  
          public string Text
          {
              get { return TextControl.Text; }
              set { TextControl.Text = value; }
          }
  
          private void TextControl_KeyUp(object sender, KeyEventArgs e)
          {
              if (e.Key == Key.Enter)
              {
                  Focus();
              }
          }
  
      }
  }
  </code></pre>
  
  <p>Any ideas what I'm doing wrong?</p>