locked
How can i close MessageDialog from code?

    Question

  • Hello,

    Is it possible to close an already open MessageDialog without user interaction, from javascript code?

    Thanks

    Saturday, March 9, 2013 9:04 PM

Answers

  • Hi Tamás,

    If you mean the popup message box produced by using "Windows.UI.Popups.MessageDialog" class, I'm afraid this class doesn't provide programmtic interface for us to close it in code.

    In case you want a closable message dialog, you can consider implementing a custom message dialog by displaying a popup windows (using custom <div>) which mask the entire app screen.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, March 11, 2013 4:01 AM
    Moderator

All replies

  • Hi,

    You may use the javascript as follow:

    document.getElementById("lblMessage").innerHTML = "";


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 11, 2013 3:14 AM
  • Hi Tamás,

    If you mean the popup message box produced by using "Windows.UI.Popups.MessageDialog" class, I'm afraid this class doesn't provide programmtic interface for us to close it in code.

    In case you want a closable message dialog, you can consider implementing a custom message dialog by displaying a popup windows (using custom <div>) which mask the entire app screen.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, March 11, 2013 4:01 AM
    Moderator
  • You could bring up the settings charm from code. It will close the dialog.
    Monday, March 11, 2013 10:13 AM