Jack Detrick
Jack Detrick

Reputation: 67

c++/winRT Navigation between two pages

I'm attempting to navigate from a page (SettingsPage) to another page (Page1). Here's what tried:

this->Frame::Navigate(typeid(Page1))

And I get this error - Error (active) E0244 qualified name is not a member of class "winrt::Calculator::implementation::SettingsPage" or its base classes ...

My question - what is the proper way to make this call.

Upvotes: 1

Views: 1695

Answers (1)

IInspectable
IInspectable

Reputation: 51506

Use the xaml_typename function template to get an object that suitably describes a type to XAML (as a TypeName struct) in C++/WinRT. Make sure to pass an appropriately qualified type, e.g.

this->Frame().Navigate(xaml_typename<Page1>());

Make sure to #include <winrt/Windows.UI.Xaml.Interop.h> which defines the xaml_typename function template.

Note that Frame is a property of Page, that's accessed using parentheses in C++/WinRT. Also note that Navigate is a non-static class member, so you cannot use the scope resolution operator (::).

Upvotes: 2

Related Questions