The MediaElement is a WPF element that wraps all the functionality of the MediaPlayer class. Like all elements, the MediaElement is placed directly in your user interface. If you're using the MediaElement to play audio, this fact isn't important, but if you're using the MediaElement for video, you place it where the video window should appear.
A simple MediaElement tag is all you need to play a sound. For example, if you add this markup to your user interface:
the test.mp3 audio will be played as soon as it's loaded (which is more or less as soon as the window is loaded).
Playing Audio Programmatically
Usually, you'll want the ability to control playback more precisely. For example, ...