您的位置:首页 > 编程语言 > C#

Windows Phone 选择按钮并且知道你选了什么

2015-04-27 16:27 148 查看
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Margin="0,2,0,15" Content="有提示的按钮" Click="Button_Click"/>
<StackPanel Grid.Row="1">
<Button Content="有提示的按钮" Margin="0,2,0,15" Click="Button_Click_1"/>
<TextBlock Name="text" FontSize="32"/>
</StackPanel>
</Grid>
private void Button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("没有提示的按钮");
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
MessageBoxResult res = MessageBox.Show("有按钮的提示", "提示按钮", MessageBoxButton.OKCancel);
switch(res){
case MessageBoxResult.Cancel:
this.text.Text = "你取消了按钮";
break;
case MessageBoxResult.OK:
this.text.Text = "你点击了按钮";
break;

}
}








内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐