The MessageBox pop-up box for Windows Phone 7 is not very enjoyable. Recently, the coding4fun component is used to provide a pop-up box, which is quite good and easy to use. I 'd like to promote it here.Coding4funOpen-source components:Http://coding4fun.codeplex.com/There is a demo in it. Some other controls are also quite good.
There are 5 different types of pop-up windows
1.Toastprompt: The display effect is similar to that of the Tusi push notification. A message is displayed on the screen and then disappears.
syntax
private void toast_click ( Object sender, routedeventargs E)
{< br> var toast = New toastprompt {
title = " basic " ,
message = toastlongmsg,
};
toast. show ();
}
2.Aboutprompt: The pop-up box is displayed in the middle of the screen. Other pop-up boxes are displayed above the screen.
Syntax used:
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 ( " Meh? " );
}
3.Passwordinputprompt: Enter the password in the pop-up window.
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 ();
}
Void Input_completed ( Object Sender, popupeventargs < String , Popupresult > E)
{
If (E. popupresult = Popupresult. OK)
MessageBox. Show ( " You typed: " + E. Result );
Else If (E. popupresult = Popupresult. cancelled)
MessageBox. Show ( " Cancelled! " + E. Result );
Else
MessageBox. Show ( " Meh? " + E. Result );
}
4.Inputprompt: Enter the pop-up boxTEnter other information in the input box.
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 ();
}
Void Input_completed ( Object Sender, popupeventargs < String , Popupresult > E)
{
If (E. popupresult = Popupresult. OK)
MessageBox. Show ( " You typed: " + E. Result );
Else If (E. popupresult = Popupresult. cancelled)
MessageBox. Show ( " Cancelled! " + E. Result );
Else
MessageBox. Show ( " Meh? " + E. Result );
}
5.Messageprompt: Message pop-up box, a common message pop-up box, similar to the default systemMessageBoxDialog box.
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 ();
}
Void Stringobject_completed ( Object Sender, popupeventargs < String , Popupresult > E)
{
If (E. popupresult = Popupresult. OK)
MessageBox. Show ( " OK: " + E. Result );
Else If (E. popupresult = Popupresult. cancelled)
MessageBox. Show ( " Cancelled: " + E. Result );
Else
MessageBox. Show ( " Meh? : " + E. Result );
}
The following figure shows the meaning of the property of the control.
The pop-up box control supports embedding a XAML file in the pop-up window.
IndicatesXAMLControls page class assignedBodyAttribute
For example
Messageprompt. Body = new bodyusercontrol ();
Let's take a look.
At the end of this article, we will provide an introduction to the following:
Http://www.windowsphonegeek.com/articles/Coding4Fun-WP7-Message-Prompt-in-depth