I thought that I would make a WCF based media player in a standard windows form so I whipped up the following:
vb Code:
Public Class Form1 Dim uc As System.Windows.Controls.MediaElement Private Sub btnLoadAndPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadAndPlay.Click Dim host As New System.Windows.Forms.Integration.ElementHost host.BackColor = Color.Black host.Dock = DockStyle.Fill Me.Controls.Add(host) uc = New System.Windows.Controls.MediaElement uc.UnloadedBehavior = Windows.Controls.MediaState.Manual host.Child = uc uc.Source = New Uri("c:\jukebox\music\0034615D380FF91A-12.mpg") End Sub Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click uc.Stop() End Sub 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




Code Project - "Best VB.NET article of October 2011"
on the left <--)
Reply With Quote