Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

wpf

xaml

winui

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

like image 642
Zana Masoud Avatar asked Jun 23 '20 18:06

Zana Masoud


People also ask

Can I use WinUI in WPF?

With support for both desktop and UWP apps, you can build with WinUI from the ground up, or gradually migrate your existing MFC, WinForms, or WPF apps using familiar languages such as C++, C#, Visual Basic, and JavaScript (using React Native for Windows).

What is winui3?

WinUI 3 is the native UI platform component that ships with the Windows App SDK (completely decoupled from Windows SDKs). The Windows App SDK provides a unified set of APIs and tools that can be used to create production desktop apps that target Windows 10 and later, and can be published to the Microsoft Store.

What is XAML?

Extensible Application Markup Language (XAML) is a declarative language that's based on XML. XAML is used extensively in the following types of applications to build user interfaces: Windows Presentation Foundation (WPF) apps. Universal Windows Platform (UWP) apps.


1 Answers

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

like image 121
Tam Bui Avatar answered Oct 13 '22 18:10

Tam Bui