How can I use XAML custom control in Windows Runtime Component?

Volker Veidt 36 Reputation points
2022-09-22T13:15:32.26+00:00

Hi!
Though I have another issue, by reducing the sample's complexities, I hit to an error that cannot refer XAML control in Windows Runtime Component (WRC). Both of library and stub are in C++/WinRT. The current error output is;

C2039: 'CppXamlWRC': is not a member of 'winrt'

The library is referred "by project (*.winmd)", and the build is almost finish successfully. It seems to be a basic, but I cannot find the way out. Please help me. The code and details are here.

---added 09/30/2022
... I'm still working with this issue.
In the page of XAML where the user control consumed, just a blank is shown when I specified its Height and Width properties. There is no color, border, text but "something".
Does anyone know the way to show its content?

246348-stubcs2.png

To see this, please download the code from the repository. There are tree folders.

  1. make "CppXamlWRC\CppXamlWRC.sln". It's output a nuget package.
  2. make StubCs\StubCs.sln and run. This cause this issue.
    The solution StubCpp\StubCpp.sln is a C++ project. This should work correctly.
Universal Windows Platform (UWP)
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
801 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,788 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Volker Veidt 36 Reputation points
    2022-11-30T06:00:05.043+00:00

    Ok, I waited for about two months in vain. I've thought and guessed a lot of things. Please allow me to show some of them. These are just my thoughts, no evidence nor truth.

    • In short, my asking may come to "How can I use SwapChainPanel in WinUI3 with C#?". For the optimized speed and productivity, I really want to use DirectX12 in C++(/WinRT) interop with C#.
    • The way Microsoft shows (use user control via NuGet package) is far from realistic solution. Because it is too difficult to debug. I think it should be as easy as usual C++ DLL in C# application (I hope it is easier and faster than "DllImport".)
    • Is the next of DirectX 12 Ultimate going to Vulkan? Both of them, NVidia concerns. Intel have gone to ML or their own library. Because DirectX 12 Ultimate may be the ultimate, there seems no DirectX 13. (I understand the U.S. nation hate the number.) So, the rest is Vulkan. If not, for C#, there should be new official library/wrapper like ComputeSharp. (Managed DirectX?, XNA? no, no. It should be .Net Native and support WinUI3, at least.) Why don't you make DirectXI (not "X" but Eleven), or had already given it up?
    • The "Project Reunion". There was a party who did not gather there. Team DirectX. Though the project prepared SwapChainPanel for their playground, the team's boss sticks to "Insert floppy disk and push power button!". Lock them in the box named X.

    I've had a chance to hear major UI company about WinUI3. They say "About WinUI3, just watching it's popularity." They think Microsoft does NOT get serious spreading WinUI3. It seems that Microsoft stop developing XAML for desktop.
    I know Microsoft never admit death of libraries. In fact, DirectX 9 still can be downloaded. But in my thought, no enhance means end of software. Is XAML fading out?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.