question

VolkerVeidt-8520 avatar image
0 Votes"
VolkerVeidt-8520 asked VolkerVeidt-8520 edited

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

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*.




windows-uwpc++windows-app-sdk-winui3
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Now I'm modifying "app.xaml" but I cannot solve it by now. Need more XAML knowledge.

0 Votes 0 ·

Have you checked this document here: Create a C#/WinRT component, and consume it from C++/WinRT. Please follow the document and try to use the component in your C++/WinRT project. Will this work?

0 Votes 0 ·

Thank you for the suggestion.
Yes, I've read it once but this case, my final goal is to make windows runtime component in C++/WinRT (with XAML) and consume it in C#, language reversed.
As pre-Stage of it, I've just tried to use C++/WinRT component by C++/WinRT application, Then I stuck there. ...orz There are no C# by now. It will be next asking.
There should be practical mistake in my code/XAML because both of application and library component are in same language. Are there any basic articles that shows consuming C++ WRC (with XAML custom control) from C++/WinRT application?

Anyway, I've not compared the article to this case well as you suggest. Now I read it more precisely.

0 Votes 0 ·

Hi!
Thanks for your advice, now I could build/run C++WRC and C++App successfully. So I could proceed to step 2, consume C++ WRC xaml control by C# app. This is the final purpose.
I've added C# projection project to WRC solution to change from "project reference" to "NuGet reference".
And made new C# stub solution.
The nuget package seems to be built successfully, but I cannot see WRC xaml object.
In C# stub, to make build successfully, I had to modify App.xaml. So, I guess there are some mistakes about reference settings.
The **current code** has no error to build, I could not find out why it is. If you have some reference or knowledge, please share it.

244445-stubcpp.png


0 Votes 0 ·
stubcpp.png (317.4 KiB)

0 Answers