Search code examples
windows-store-appswin-universal-app

Does the MessageDialog class for UWP Apps support three buttons on Mobile?


I'm creating a simple program for reading text file on the Windows Phone. I decided to make it a Universal Windows Platform (UWP) App.

In the app, I have a very simple MessageDialog, with three options, Yes, No, Cancel. It works perfectly on the Desktop and in the Simulator. However, when testing with the actual device, the ShowAsync method fails with the message: "Value does not fall in the expected range".

This only happens if there are more than two commands registered in the dialog. Does the MessageDialog class really supports up to three commands - as the documentation suggests - or is this only applying for UWP Apps running on Desktop devices?


Solution

  • At the moment, there is a clear statement in the docs:

    The dialog has a command bar that can support up to 3 commands in desktop apps, or 2 commands in mobile apps.

    Sad but true: on mobiles, there are two commands only. Need more? Use ContentDialog instead.