ImageResourceConverter - Binding could be compiled to improve runtime performance if x:DataType is not explicitly null. #2445
-
Hi All, I have enabled the following in my csproj, that is to take advantage of compiled bindings <MauiEnableXamlCBindingWithSourceCompilation>true</MauiEnableXamlCBindingWithSourceCompilation>
<WarningsAsErrors>$(WarningsAsErrors);XC0022;XC0023</WarningsAsErrors> When I use the following I get an error that the binding could be compiled to improve runtime performance which I expect but I cannot seem to get past the error <Image
Grid.Column="0"
x:DataType="{x:Null}"
Aspect="AspectFit"
HeightRequest="24"
Source="{Binding Source={StaticResource ConversationImageSource}, Converter={StaticResource ImageResourceConverter}}"
VerticalOptions="Center"
WidthRequest="24" /> If I disable/remove the Is it possible to use compiled binding in this case so I can keep the |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Why are you setting |
Beta Was this translation helpful? Give feedback.
-
Can you supply a copy of your ResourceDictionary including the ConversationImageSource definition? |
Beta Was this translation helpful? Give feedback.
-
in case anyone stumbles on this, the solution ended up quite simple Source="{Binding Source={StaticResource LogoVariant2ImageSource}, Converter={StaticResource ImageResourceConverter}, x:DataType=x:String}" |
Beta Was this translation helpful? Give feedback.
-
Setting |
Beta Was this translation helpful? Give feedback.
in case anyone stumbles on this, the solution ended up quite simple
:DataType=x:String
as suggested here dotnet/maui#27292 (reply in thread)