Condividi tramite


Modello di funzione winrt::xaml_typename (C++/WinRT)

Funzione helper che restituisce il nome del tipo di un tipo Windows Runtime, sotto forma di oggetto Windows::UI::Xaml::Interop::TypeName. Vedere anche la funzione GetRuntimeClassName .

Sintassi

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

Parametri di modelli

typename TTipo di classe Windows Runtime.

Valore restituito

Oggetto Windows::UI::Xaml::Interop::TypeName che rappresenta il tipo.

Esempio

// 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()));
    ...
}

Requisiti

SDK minimo supportato: Windows SDK versione 10.0.17134.0 (Windows 10, versione 1803)

Spazio dei nomi: winrt

Intestazione: %WindowsSdkDir%IncludeWindowsTargetPlatformVersion<>\cppwinrt\winrt\Windows. UI. Xaml.Interop.h (non incluso per impostazione predefinita)

Vedi anche