XAML中有MediaElement:
<MediaElement Source="sound.mp3" AutoPlay="False" x:Name="Sound"></MediaElement>
<Button x:Name="Control" Content="Button" Click="Control_Click_1"/>
代码:
Private Sub Control_Click_1(sender As Object, e As RoutedEventArgs)
Sound.Stop() // rewind to start
Sound.Play()
End Sub
我想通过点击按钮几次组合相同的声音。有任何想法吗? 谢谢。