Camera preview in WPF Desktop apps using WinRT MediaCapture
CameraPreview allows previewing the camera video stream of the WinRT MediaCapture API in Desktop WPF apps.
<Grid> <Image Name="Preview"/> </Grid>
The C# code behind creates
MediaCapture, initializes it, and passes it to
CameraPreview. This object is then set as source of the
<Image> element and preview is started.
var capture = new MediaCapture(); await capture.InitializeAsync(); var preview = new CapturePreview(capture); Preview.Source = preview; await preview.StartAsync();