Windows phone中如何使用丰富的弹出框提示
。以下是常用的几种方式:
首先需要添加引用Coding4Fun.Phone.Controls.dll
Coding4Fun官网:http://coding4fun.codeplex.com/
1.ToastPrompt:类似于土司推送通知一样的显示效果,在屏幕上面出现一条消息,然后再消失。
private void Toast_Click(object sender, RoutedEventArgs e) { var toast = new ToastPrompt { Title = "Basic", Message = ToastLongMsg, }; toast.Show(); }
2.AboutPrompt:说明弹出框,特点是弹出框会在屏幕中间,其他的弹出框是在屏幕的上方。
private void About_Click(object sender, RoutedEventArgs e) { var about = new AboutPrompt(); about.Completed += baseObject_Completed; about.Show(); } void baseObject_Completed(object sender,PopUpEventArgs<object, PopUpResult> e) { if (e.PopUpResult == PopUpResult.Ok) MessageBox.Show("OK!"); else if (e.PopUpResult == PopUpResult.Cancelled) MessageBox.Show("CANCELLED!"); else MessageBox.Show("else?"); }
3.PasswordInputPrompt:密码输入弹出框,用于输入密码信息。
private void Password_Click(object sender, RoutedEventArgs e) { var passwordInput = new PasswordInputPrompt { Title = "Basic Input", Message = "I'm a basic input prompt", }; passwordInput.Completed += input_Completed; passwordInput.Show(); }
4.InputPrompt:输入弹出框,用于t弹出输入框输入其他的信息。
private void Input_Click(object sender, RoutedEventArgs e) { var input = new InputPrompt { Title = "Basic Input", Message = "I'm a basic input prompt", }; input.Completed += input_Completed; input.Show(); }
5.MessagePrompt:消息弹出框,普通的消息弹出框,类似于系统默认的messagebox弹出框。
private void Message_Click(object sender, RoutedEventArgs e) { var messagePrompt = new MessagePrompt { Title = "Basic Message", Message = "I'm a basic message prompt. ", }; messagePrompt.Completed += stringObject_Completed; messagePrompt.Show(); }