Using the following code in a ContentPage will cause an error: Cannot resolve type "http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
.
1
2
3
4
5
6
7
|
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
<ContentPage.Resources>
<ResourceDictionary>
<toolkit:InvertedBoolConverter x:Key="InvertedBoolConverter"/>
<!--<toolkit:IsEqualConverter x:Key="IsEqualConverter"/>-->
</ResourceDictionary>
</ContentPage.Resources>
|
When using CommunityToolkit in an app project, the following code is required
1
2
3
4
|
var builder = MauiApp
.CreateBuilder()
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
|
This code cannot be used in a class library.
The error occurs because the Visual Studio linker removes code it considers invalid during compilation. To resolve this, add x:Name to each converter.
1
2
|
<toolkit:InvertedBoolConverter x:Key="InvertedBoolConverter" x:Name="InvertedBoolConverter"/>
<!--<toolkit:IsEqualConverter x:Key="IsEqualConverter" x:Name="IsEqualConverter"/>-->
|