I am trying C++/WinRT and the WinUI templates available in VisualStudio. I am confused about namespaces ::winrt::Microsoft
and ::winrt::Windows
. I only know about the former one because auto-generated callback functions used a type from ::winrt::Microsoft
, and wouldn't compile because I passed identically named type from ::winrt::Windows
namespace by mistake. I couldn't find more information about ::winrt::Microsoft
, couldn't even find official documentation.
From what I can say, ::winrt::Microsoft
and ::winrt::Windows
have mostly identically named types, but some types are missing from ::winrt::Microsoft
. For example, ::winrt::Windows::UI::Colors
and ::winrt::Microsoft::UI::Colors
both exist, but ::winrt::Windows::UI::Color
has no "alternative" in the Microsoft namespace.
Questions:
::winrt::Microsoft
is missing some types?Windows
is the original namespace, where all UI-related types live. Some of those types were 'reinvented' into the Microsoft
namespace as part of moving WinUI out of its UWP-only misery.
If a type is available in the (newer) Microsoft
namespace then use that. The transition is not yet complete, so some types are missing.