Reputation: 136
i need to play a sound on the touch of screen, and it should remain in play state until user get his hands off from the screen. here is the code of mine,
private void OnMouseDown(object sender, Moenter code hereuseButtonEventArgs e)
{
clicked = true;
ColoringSound.Source = new Uri("Sounds/drawing.mp3", UriKind.Relative);
ColoringSound.Play();
}
private void OnMouseUp(object sender, MouseButtonEventArgs e)
{
clicked = false;
}
Upvotes: 0
Views: 568
Reputation: 70160
There is an MSDN article that describes how to loop MediaElements, all you have to do to stop a looped sound is invoke the Stop method.
Upvotes: 1