In Windows Phone development, you can use the MessageBox. Show () method to implement message reminders. However, the interface is really ugly. After each pop-up, you need to click the OK button to disappear. In contrast, the toast method in Windows Phone SDK is good. Unfortunately, toast needs to interact with the server and cannot be called locally as if it was MessageBox. Fortunately, the coding4fun class library implements the local toastprompt control, which is very convenient.
First, as shown below, clicking the button will trigger the pop-up box above. This is just a local call :(CodeDownload the example here:
Http://www.windowsphonegeek.com/upload/articles/WP7SampleProject20.zip)
To achieve this effect, follow these steps:
1, download coding4fun class library, address http://coding4fun.codeplex.com/
2. decompress the downloaded file, find coding4fun. Phone. Controls. dll, create a DLL folder, and add it to the project.
3. Add DLL references to the Project
4. Remember to rebuild the project. Otherwise, the Assembly file may not be found during running.
5. Add the using coding4fun. Phone. Controls namespace to the backend CS code of the page where the control is to be used.
6. Add the following code to the event function that needs to use the pop-up message (here I select the first effect. For other effect codes, see the example)
VaR toast = new toastprompt {Title = "simple usage", message = "message", imagesource = new bitmapimage (New uri (".. \ applicationicon.png ", urikind. relativeorabsolute)}; toast. show ();
In fact, in many cases, toast does not need to contain so many things. It usually requires only one message, so it is generally written as follows:
Private void button_click (Object sender, routedeventargs e) {var toast = new toastprompt {message = "Diaoyu Islands are from China, and AOI is from the World",}; toast. Show ();}
Finally