title: How to run the MediaPlayer on repeat mode in C# WPF?
body: <p>I have a <code>MediaPlayer</code></p>
  
  <pre><code>public MediaPlayer backgroundMusicPlayer = new MediaPlayer ();
  </code></pre>
  
  <p>Now, because its background music, I'd like to repeat the song after its over.</p>
  
  <p>How should I implement this?</p>
  
  <p>This is what I found:</p>
  
  <p>An event is raised when the song ends: <code>backgroundMusicPlayer.MediaEnded</code></p>
  
  <p>I am not sure what I should do about this? I am new to C# and programming in general.</p>
  
  <p>EDIT:</p>
  
  <pre><code>public void PlaybackMusic ( )
  {
      if ( backgroundMusicFilePath != null )
      {
           backgroundMusicPlayer.Open (new Uri (backgroundMusicFilePath));
           backgroundMusicPlayer.MediaEnded += new EventHandler (Media_Ended);
           backgroundMusicPlayer.Play ();
  
           return;
      }
  }
  
  private void Media_Ended ( object sender, EventArgs e )
  {
      backgroundMusicPlayer.Open (new Uri (backgroundMusicFilePath));
      backgroundMusicPlayer.Play ();
  }
  </code></pre>
  
  <p>This works, but I need to open the file every time. Is this the only way?</p>