I'm trying to play the same overlapping sound whenever a button is pressed. I tried with MediaElement and SoundPlayer, but the music stops and starts again. I need to create a new instance, but creating new MediaElement() and adding to the Stage didn´t work too开发者_JS百科 :-/
Thanks for your help
Check here: http://www.interact-sw.co.uk/iangblog/2008/01/25/wpf-concurrent-audio
Create multiple MediaPlayers in the CodeBehind.
I had no succeed with MediaPlayers, but it works:
MediaElement mp = new MediaElement();
soundPanel.Children.Add(mp);
mp.Source = new Uri(key_sound, UriKind.RelativeOrAbsolute);
精彩评论