首页 > 解决方案 > 如何使用 WinUI 3.0 桌面应用程序的 Project Reunion 模板在 Windows 应用程序中添加相机功能?

问题描述

我正在使用 Visual Studio 2019 中的 Project Reunion WinUI 模板开发桌面应用程序。我们需要从应用程序中捕获图像并保存它。

我尝试了CameraCaptureUI(这适用于 UWP 应用程序,但不适用于 Project Reunion)

代码:

CameraCaptureUI dialog = new CameraCaptureUI();
Size aspectRatio = new Size(16, 9);
dialog.PhotoSettings.CroppedAspectRatio = aspectRatio;
StorageFile file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (file == null)
{
}

错误:

错误

我们尝试使用CaptureElement Reference,但 Project Reunion 不支持它。

让我知道我在这里遗漏了什么。

提前致谢。

标签: c#windowsdesktop-applicationwinuiwinui-3

解决方案


Currently not available in WinUI3 (Reunion).

https://github.com/microsoft/microsoft-ui-xaml/issues/4710


推荐阅读