Anatomy of a WinUI in Desktop project
Now that we have a new empty WinUI project loaded in Visual Studio, let’s examine the different components. In Solution Explorer, you will see two XAML files, named
MainWindow.xaml. We will start by discussing the purpose of each of these. Both files can be seen in the following screenshot of Solution Explorer:
Figure 2.5 – The new WinUI solution in Solution Explorer
App.xaml file, as its name implies, stores resources available across the entire application. If you have any templates or styles that will need to be used across multiple windows, they should be added at the
The new project’s
App.xaml file will contain some initial markup, as illustrated in the following code snippet:
<Application x:Class="MyMediaCollection.App" xmlns="http://schemas.microsoft.com/winfx...