winrt::xaml_typename function template (C++/WinRT)

A helper function that returns the type name of a Windows Runtime type, in the form of a Windows::UI::Xaml::Interop::TypeName object. Also see the GetRuntimeClassName function.

Syntax

template <typename T>
inline winrt::Windows::UI::Xaml::Interop::TypeName xaml_typename();

Template parameters

typename T A Windows Runtime class type.

Return value

A Windows::UI::Xaml::Interop::TypeName object representing the type.

Example

// App.cpp
void App::OnLaunched(LaunchActivatedEventArgs const& e)
{
    Frame rootFrame{ nullptr };
    auto content = Window::Current().Content();
    if (content) rootFrame = content.try_as<Frame>();
    ...
    rootFrame.Navigate(xaml_typename<Bookstore::MainPage>(), box_value(e.Arguments()));
    ...
}

Requirements

Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)

Namespace: winrt

Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\Windows.UI.Xaml.Interop.h (not included by default)

See also