question

65383190 avatar image
0 Votes"
65383190 asked 65383190 commented

NavigationView (C++/WinRT) official sample does not work.

https://docs.microsoft.com/en-us/windows/apps/design/controls/navigationview
The second parameter of NavView_ItemInovked and NavView_Navigate are not equal. First namespace is muxc(Microsoft.UI.Xaml.Controls, second is Windows.UI.Xaml.Media..., but in the NavView_ItemInovked,args was
deliver to NavView_Navigate. When I run it, there's errors

“void winrt::WaterWorkBench::implementation::MainWindow::NavView_Navigate(std::wstring,const winrt::Windows::UI::Xaml::Media::Animation::NavigationTransitionInfo &)”: can not convert paramenter 2 from “winrt::Microsoft::UI::Xaml::Media::Animation::NavigationTransitionInfo” to “const winrt::Windows::UI::Xaml::Media::Animation::NavigationTransitionInfo &”

how to fix it or how to convert it.

windows-app-sdk
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.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered 65383190 commented

Replace Windows by Microsoft, like

 //Windows::UI::Xaml::Media::Animation::NavigationTransitionInfo const& transitionInfo)
  Microsoft::UI::Xaml::Media::Animation::NavigationTransitionInfo const& transitionInfo)

as indicated in the doc to migrate UWP => WinUI (Migrate from UWP to the Windows App SDK)


· 3
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.

Thank u, It works.
So should I replace all the "Windows" in the code when I make a WinUI 3 project?
Does Every API in the Windows SDK have the corresponding subsititute in WinUI API?

0 Votes 0 ·

I usually do this (but not for all, like for example Windows::Foundation)

0 Votes 0 ·

ok. It seems that this is the only way to solve the problem. Anyway, thx.

0 Votes 0 ·