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
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 .
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 .
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
great post thank you
welcome 🙂
Hi, great Tutorial but i would like to know how to make a button that stops the sound playing
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
It works for WP7 Silverlight projects too …
how does it work in wp7 application for visualstudio10