Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off default sound when displaying MessageBox in WP7

Is there a way to turn off the sound that the Messagebox plays when it is displayed in WP7?

like image 618
Tyler Avatar asked May 07 '11 00:05

Tyler


2 Answers

There's no way to change this behaviour with the Silverlight MessageBox class. If, however, you use Guide.BeginShowMessageBox (from the XNA libraries) you can control whether sounds are played or not.

like image 71
Matt Lacey Avatar answered Oct 11 '22 11:10

Matt Lacey


No, currently there is no way you can disable the sound that is triggered by the MessageBox class. That is a feature tied to the system and unless the device is on mute, the sound will be played.

With XNA's async version you can do this, though (as mentioned by Matt):

Guide.BeginShowMessageBox("Title", "Text", new List<string>() { "OK" }, 0, MessageBoxIcon.None, new AsyncCallback(YourCallback), null);

Here, MessageBoxIcon defines the sound and not the icon (which is nonexistent on Windows Phone for a MessageBox).

Note: you need yo add a reference to Microsoft.Xna.Framework.GamerServices.

like image 45
Den Delimarsky Avatar answered Oct 11 '22 09:10

Den Delimarsky