maui icon indicating copy to clipboard operation
maui copied to clipboard

[Trimming] Use typed bindings internally

Open simonrozsival opened this issue 1 year ago • 1 comments

Description of Change

This is a follow-up to #20415. Since all bindings now can be typed bindings, I started replacing some bindings declared in code with typed bindings to fix trimming warnings in dotnet new maui on iOS. I haven't even tried to replace any bindings in Tizen, Windows, or Android specific code.

ShellSearchResultRenderer changes

The default template of ShellSearchResultRenderer uses SearchHandler.DisplayMemberName as the path for the binding. I don't see a good way to reimplement this in a way which would work well with typed bindings (would we need Func<object, string> DisplayMember in addition to DisplayMemberName? would that be a good API?). Instead, I decided to propose a new feature switch that will disable the default template and required to always define custom ItemTemplate.

Issues Fixed

Contributes to #19397 - fixes 9 trimming warnings.

simonrozsival avatar Feb 14 '24 08:02 simonrozsival

@StephaneDelcroix Yes, the problem with the expressions-based bindings (#19995) was performance. I agree that the name isn't the best and there aren't any checks that the delegates access just the single level so it can be misused. I proposed a different way to approach this via source generators (#20574) and if that is approved in some form, we could use it instead of this internal API and drop it.

simonrozsival avatar Feb 20 '24 09:02 simonrozsival

@jonathanpeppers I think this PR is now ready to be merged

simonrozsival avatar Feb 29 '24 08:02 simonrozsival