title: MediaElement Class Is Not Play the Media file in WPF Application
body: <p>MainWindow.Xaml</p>
  
  <pre><code>&lt;MediaElement Margin="10,10,10,0 " Name="McMediaElement" Width="450" Height="250" LoadedBehavior="Manual" Stretch="Fill"
                MediaOpened="Element_MediaOpened" MediaEnded="Element_MediaEnded" UnloadedBehavior="Stop" /&gt;
      &lt;Label Grid.Column="1" Grid.Row="1" Height="28" Margin="82,0,99,3.52" 
             Name="FileNameLabel" VerticalAlignment="Bottom" Background="LightGreen"&gt;
      &lt;/Label&gt;
      &lt;Button Height="23" Name="BrowseButton" Width="113" Grid.Column="1" HorizontalAlignment="Right" 
              Margin="0,0,182,7.04" Grid.Row="1" VerticalAlignment="Bottom" Grid.ColumnSpan="2"
              FontWeight="Bold" Click="BrowseButtonClick"&gt;
          Browse a Media
      &lt;/Button&gt;
  </code></pre>
  
  <p>When Click BrowseButton Its get the file from open Dialog box and it put into the Lable control as FileNameLabel</p>
  
  <pre><code>private void BrowseButtonClick(object sender, RoutedEventArgs e)
  {
      System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
      dlg.InitialDirectory = "c:\\";
      dlg.Filter = "Media files (*.wmv)|*.wmv|All Files (*.*)|*.*";
      dlg.RestoreDirectory = true;
      if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
      {
          string selectedFileName = dlg.FileName;
          FileNameLabel.Content = selectedFileName;
          McMediaElement.Source = new Uri(selectedFileName);
          McMediaElement.UpdateLayout();
          McMediaElement.Play();
      }
  }
      private void Element_MediaOpened(object sender, EventArgs e)
      {
          timelineSlider.Maximum = McMediaElement.NaturalDuration.TimeSpan.TotalMilliseconds;
      }
  
      // When the media playback is finished. Stop() the media to seek to media start.
      private void Element_MediaEnded(object sender, EventArgs e)
      {
          McMediaElement.Stop();
      }
  </code></pre>
  
  <p>its does not play the media file.so Plaese Suggest what the problem in code.</p>