A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/uwp/cpp-ref-for-winrt/getruntimeclassname below:

GetRuntimeClassName function (C++/WinRT) - Windows UWP applications

GetRuntimeClassName function (C++/WinRT)

In this article

A member function (of a generated implementation type) that returns a string containing the fully-qualified type name of the Windows Runtime class being implemented.

For an explanation of the implementation type and projected type concepts, see Consume APIs with C++/WinRT and Author APIs with C++/WinRT.

This is a member function of generated implementation types. To retrieve the runtime class name of any arbitrary IInspectable, use winrt::get_class_name. Also see the function that both methods are based on, which is IInspectable::GetRuntimeClassName.

Syntax
winrt::hstring GetRuntimeClassName() const;
Return value

A winrt::hstring containing the fully-qualified type name of the Windows Runtime class implemented by the implementation type.

Example
// MainPage.cpp
void winrt::MyProject::implementation::MainPage::f()
{
    winrt::hstring name = GetRuntimeClassName();
    assert(name == L"MyProject.MainPage");
}

You can implement ICustomPropertyProvider::Type like this.

Windows::UI::Xaml::Interop::TypeName Type()
{
    return Windows::UI::Xaml::Interop::TypeName{ GetRuntimeClassName() };
};

Or you can use the winrt::xaml_typename function template.

Requirements

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

Tool: cppwinrt.exe

See also

Additional resources

In this article

Was this page helpful?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4