'How can we add a NavigationViewItem in C++/WinRT in a WinUI3 desktop app?

I am having difficulty in finding an example of adding a NavigationViewItem in a WinRT/C++ WinUI3 desktop app. This question is answered for C# in the following Q&A.

But I cannot find the comparable answer for WinRT/C++. I understand that effectively I want to add the new NavigationViewItem to the NavigationView's MenuItems() list. It's just that I can't find the syntax to do that.



Solution 1:[1]

Microsoft published that in their github for C++/WinRT in a WinUI3 desktop.

  1. NavigationView winui c++/winrt

  2. microsoft / WindowsAppSDK-Samples

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ody Light