Introduction to Windows 8 style application development 22 Messagedialog

Source: Internet
Author: User

Messagedialog Overview

Messagedialog refers to the dialog box.

The dialog box contains up to three commands in the command bar. If we specify any commands, a default command will be added to the dialog box to close the dialog box.

When the dialog box pops up, all the elements in the interface will be displayed below the dialog box, and any touch events will be blocked until the user responds to the dialog box.

Additional dialog boxes should be used sparingly.

Note: The MessageBox object is canceled in the Windows 8 style application and replaced by the Messagedialog object.

Messagedialog Common Properties and methods

The Messagedialog class contains two types of constructors:

1) messagedialog (String)

Public Messagedialog (string content);

The content parameter represents the information that is displayed to the user in the dialog box.

2) Messagedialog (string,string)

Public Messagedialog (string content, string title);

The content parameter represents the information that is displayed in the dialog box to the user, and the title parameter represents the caption information displayed in the dialog box.

Messagedialog Class Common methods:

1) Showasync ()

Public iasyncoperation<iuicommand> Showasync ();

Displays the dialog box asynchronously.

Messagedialog Class Common Properties:

1 Cancelcommandindex property: Gets or sets the index of the cancellation command, the user presses the ESC key and executes the cancellation command;

2 Commands property: Gets the command displayed in the command bar of the dialog box;

3 content property: Gets or sets the main contents displayed in the dialog box;

4 Defaultcommandindex Property: Gets or sets the index of the default command, and the user presses the ENTER key to execute the default command;

5 Options Property: Gets or sets the selected item in the dialog box;

6 Title Property: Gets or sets the caption in the dialog box;

Note: The Messagedialog class is not very optimized and we need to consider its impact in the thread model. In addition, you can refer to multithreading in Windows 8 Store applications: Using Windows Run-time objects in a multithreaded environment.

How to build Messagedialog

The effects of common Messagedialog objects rendering are as follows:

Effect 1: Default Shutdown command

No command to close the dialog box is set in C # code. If we do not set the shutdown command, the system adds a shutdown command by default.

Private async void Messagedialogshow ()    
 {    
     var messagedialog = new Messagedialog ("Default shutdown Command");    
                   
     await Messagedialog.showasync ();    
 }

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.