I just wanna ask why when I put the mediaElementsource in the TapEvent the sound wouldn't play something
private void listBoxItem_Tap(object sender, System.Windows.Input.GestureEventArgs e)
sound.Source = new Uri(@"Sounds/sample.mp3",UriKind.RelativeOrAbsolute);
But when I Put the sound.Sorce outside the TapEvent the Sound is Played like this :
sound.Source = new Uri(@"Sounds/sample.mp3", UriKind.RelativeOrAbsolute);
private void listBoxItem_GotFocus(object sender, RoutedEventArgs e)
Since you are explicitly calling Play(), I'm guessing you have AutoPlay=false... right?
In that case you need to wait for the MediaOpened event before calling Play().
It works in the second case because there is a significant delay between setting the source and calling Play but in the first case there is not enough time.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?