I thought that I would make a WCF based media player in a standard windows form so I whipped up the following:

vb Code:
  1. Public Class Form1
  2.  
  3.     Dim uc As System.Windows.Controls.MediaElement
  4.  
  5.     Private Sub btnLoadAndPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadAndPlay.Click
  6.         Dim host As New System.Windows.Forms.Integration.ElementHost
  7.         host.BackColor = Color.Black
  8.         host.Dock = DockStyle.Fill
  9.         Me.Controls.Add(host)
  10.         uc = New System.Windows.Controls.MediaElement
  11.         uc.UnloadedBehavior = Windows.Controls.MediaState.Manual
  12.         host.Child = uc
  13.         uc.Source = New Uri("c:\jukebox\music\0034615D380FF91A-12.mpg")
  14.     End Sub
  15.  
  16.     Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
  17.         uc.Stop()
  18.     End Sub
  19.  
  20. End Class

The video loads ok when the btnLoadAndPlay button is pressed

However the uc.Stop in the btnStop_Click does not stop the video any ideas why this may be happening?

Thanks in advance
Kris