Silverlight sound effect on alert
Posted on 2010-01-07
I'm trying to add a simple sound effect when an alert box opens in a Silverlight application.
I have added an MP3 file to my project, created a MediaElement in my user control and assigned the MP3 file as the source. In my code, I fire the MediaElement .Play() method when the alert box is displayed. I get no errors, but also no sound, even though the play method is definitely being fired. Any ideas?
Here is the relevant XAML line in my control:
<MediaElement x:Name="effectsElement" HorizontalAlignment="Left" Margin="80,16,0,84" Width="100" AutoPlay="False" Source="boing_1.mp3" Volume="1"/>