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

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Hey, wait!Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

You cannot copy content of this page