Adding a sound to the Button Click via PlaySoundAction in Windows Phone 7

Sometimes it may be necessary for you to play a sound on some action in your Windows Phone 7 .

This could be on click of the button for the user to feel that he has touched something or may be someother scenario .

You can do this easily with the help of Microsoft Expression Blend 4 with the behavious known as PlaySoundAction .

To include a sound on the button click , follow the below steps .

1. Start the Expression Blend 4 and the open the current Project .

2. Add a button to the Page from the Assets tab – Controls

Adding a sound to the Button Click via PlaySoundAction in Windows Phone 7

3. Change the Button properties like the name of the button or the text to be displayed on the button .

4. From the same assets tab – > Behaviours – select the PlaySoundAction – Drag and drop onto the button .

Adding a sound to the Button Click via PlaySoundAction in Windows Phone 7

5. In the Objects and Timeline , make sure that you select the PlaySoundAction and now go  to the properties window on the right side of the screen .

Adding a sound to the Button Click via PlaySoundAction in Windows Phone 7

6. Select the Event for which this behaviour should trigger . In our case it is the Click Event . Also select the Source file ( Media File) to play and the Volume .
7. Save all the change and press F5 to start the Application . When you click the button , you should be able to listen to the sound .

Here’s a video that demonstrates how to use PlaySoundAction in ExpressionBlend .

References

    6 Comments

  1. mobil55
    June 4, 2011
    Reply

    great post thank you

  2. June 4, 2011
    Reply

    welcome 🙂

  3. marysfetus
    July 6, 2011
    Reply

    Hi, great Tutorial but i would like to know how to make a button that stops the sound playing

  4. Joey
    November 7, 2011
    Reply

    Hi, great Tutorial but i would like to know how to make a button that stops the sound playing

    Can someone PLEASE tell me how to do that

  5. December 7, 2011
    Reply

    It works for WP7 Silverlight projects too …

  6. ramya
    January 7, 2012
    Reply

    how does it work in wp7 application for visualstudio10

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...