tags:

views:

1293

answers:

2

How do you integrate a PictureBox to display a video through WPF?

+2  A: 

You probably don't want to use PictureBox to display images in WPF because it's a Windows Forms control and therefore suffers from interop limitations.

To display an image in WPF, use the Image element. Set its Source to be, typically, a BitmapImage whose UriSource is the URI of the bitmap file (which might be on the file system). (You can use another ImageSource type if that's an easier way to interface with the webcam.)

To display video, use the MediaElement element. To display a video file, set MediaElement's Source property to the URI of the video (which again might be on the file system). If you need to pull images from the webcam in order to form the video, you need to use the MediaElement in "clock mode," which is described in the MediaElement class topic in MSDN. See also "Multimedia Overview" in the WPF SDK (http://msdn.microsoft.com/en-us/library/aa970915.aspx).

itowlson
+2  A: 

Also try WPF MediaKit. The WPF MediaKit has a VideoCaptureElement control for WebCam support!

rudigrobler