Moving to a new namespace
When you are building an application with UWP, your home is the Windows
namespace. Every API that belongs to this ecosystem is included in one of its subnamespaces. One of the most important is Windows.UI.Xaml
, which includes all the building blocks to create the UI: controls, dependency properties, styles, and so on.
When moving the UI layer to the Windows App SDK, the team had to create a different namespace, to avoid conflicts with the one built inside the operating system. As such, all the UI building blocks for WinUI are included in the Microsoft.UI.Xaml
namespace. Compared to a traditional UWP application, this introduces the following two main changes:
- If you want to port over some code you have created in UWP, you will have to change every reference to the
Windows.*
namespace toMicrosoft.*
. - When you create a new WinUI application, you will find the following declaration inside the
App.xaml
file:<Application> ...