简体   繁体   中英

Custom WinUI 3 C++/WinRT Control in C# WinUI project

I am trying to create WinUI C++/WinRT Component containing XAML control and iclude this custom control inside C# WinUI 3 project. Is this somehow possible? I had no luck yet. Could you please provide some examples if this is possible?

Reason:

Since WinUI 3 does not offer media player I want to make media player like this: https://github.com/asklar/WinAppSDK-MediaPlayer

EDIT:

So far I found WinRT APIs not supported in .NET 5 or later . I found there Windows.UI.Xaml (all classes in this namespace) which seems to be needed for creating custom c++/winrt control. After I read this I assume that it is not possible to consume custom C++/WinRT WinUI control in C# WinUI project.

在此处输入图像描述

Example:

Those are steps I created that projects.

  1. Create C# Library
  2. Create WinUI C++ Component
  3. Setup accordingly to MS Docs and Example
  4. Add WindowsSdk reference to library project
  5. Add custom control to C++ project

What I found possible is to consume custom C# WinUI contron inside WinUI C++/WinRT project, which seems to be way to go for me.

Issue should be fixed by updating Windows App SDK to 1.1.0-preview2. More information in this post .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM