Search code examples
wpfxamlwinui

The tag 'XamlControlsResources' does not exist in XML namespace 'using:Microsoft.UI.Xaml.Controls'


I was trying to use WinUI so I installed the plugin Microsoft.UI.Xaml (2.4.2) from Nuget and followed the instructions which says add This <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/> to my App.Xaml

and here is my App.Xaml file

<Application x:Class="WpfApp1.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfApp1"
    StartupUri="MainWindow.xaml">
        <Application.Resources>
            <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
        </Application.Resources>
</Application>

but it says:

The tag 'XamlControlsResources' does not exist in XML namespace 'using:Microsoft.UI.Xaml.Controls'

i tried older versions from WinUI plugin and tried .Net Core and Framework but still having this problem


Solution

  • I believe this WinUI 2.4.2 library is only compatible if you create a UWP application, not a WPF app.

    enter image description here

    Having said that, according to this documentation from Microsoft, starting with WinUI 3, you will be able to do this in WPF.

    enter image description here