How to cast from Windows.UI.Xaml.UIElement to System.Windows.Controls.UIElement

I'm trying to create a new UI for an app I developed for the Windows Store using the Windows Runtime API. This new client is going to be a WPF Desktop App. I'm trying to reuse as much code as I can but I'm facing several issues.

Fortunately there's a way to use WinRT in a WPF Desktop app (see this and this)

Now I'm blocked by the following issue: The MediaCapture class has a method to start the preview of a device, after I've started the preview I can create a CaptureElement to display the preview. CaptureElement is part of Windows.UI.Xaml.Controls and cannot be used in containers from System.Windows.Controls in which the WPF UI is built.

Am I going anywhere with this approach? what would you recommend? How can I display the preview of a device in the WPF app?

Thanks in advance

Upvotes: 2

Views: 2013

Answers (1)

Filip Skakun
Filip Skakun

Reputation: 31724

CaptureElement can't be used in desktop applications - the documentation says "[Windows Store apps only]". In general - the UI controls from WPF and WinRT/XAML can't be used outside of their respective domains (desktop/immersive UI). In a WPF app you need to use WPF controls - e.g. DirectShow for camera capture,

Upvotes: 1

Related Questions