首页 > 代码库 > wp8 入门到精通 高仿微信发信息 键盘不消失

wp8 入门到精通 高仿微信发信息 键盘不消失

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<StackPanel Orientation="Vertical">
<TextBlock Text="Hides soft keyboard on enter:" />
<TextBox x:Name="textBox" />

<TextBlock Text="Normal text box:" />
<TextBox />
</StackPanel>
</Grid>

 

public MainPage()
{
InitializeComponent();

this.textBox.KeyUp += new KeyEventHandler(textBox_KeyUp);
}

void textBox_KeyUp(object sender, KeyEventArgs e)
{
// if the enter key is pressed
if (e.Key == Key.Enter)
{
textBox.Focus();
}
}

键盘不消失