Lukas Fürst
Lukas Fürst

Reputation: 143

Undefined namespace. 'CommunityToolkit.WinUI.Controls' that could not be found. WINUI3

i am new to WinUI3. I am using this Windows Community Toolkit Gallery, which has great samples and want to implement a GridSplitter.

I see that I need

namespace
CommunityToolkit.WinUI.Controls
NuGet Packages
CommunityToolkit.Uwp.Controls.Sizers
CommunityToolkit.WinUI.Controls.Sizers

I have installed both in NuGet package manager

CommunityToolkit.WinUI.Controls.Sizers 8.1.240916

and

CommunityToolkit.Uwp.Controls.Sizers 8.1.240916

In the XAML-page, i have implemented it via xmlns:controls="using:CommunityToolkit.WinUI.Controls" as given in example in Windows Community Toolkit Gallery, but I always get the error

Undefined namespace. The 'using' URI refers to a namespace 'CommunityToolkit.WinUI.Controls' that could not be found.

What can I do?

Upvotes: 0

Views: 159

Answers (1)

Andrew KeepCoding
Andrew KeepCoding

Reputation: 13666

Since it seems that this is a WinUI 3 app, you don't need to install:

CommunityToolkit.Uwp.Controls.Sizers

Now to fix the error, open your project file (*.csproj) and edit your target versions to 22621.

<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>

You can find about this in the release notes.

Upvotes: 1

Related Questions