Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing warnings from CompiledBindings on .NET 9 on TemplateBinding #2660

Open
MichaelLHerman opened this issue Dec 3, 2024 · 3 comments
Labels
dotnet-maui/subsvc dotnet-mobile/svc Pri1 High priority, do before Pri2 and Pri3 ⌚ Not Triaged Not triaged

Comments

@MichaelLHerman
Copy link

MichaelLHerman commented Dec 3, 2024

Type of issue

Missing information

Description

After upgrading to .NET 9, I am seeing XC0022 warnings on my TemplateBindings. Documentation for neither Control Templates nor Compiled Bindings have been updated to provide information on what to do. Specify the data type on the ControlTemplate, or is there a plan for the Xaml Compiler to be able to automatically infer the data type in the future if the control template is a ControlTemplate of a particular ContentView? Samples need to be updated as well dotnet/maui-samples#547 (comment)

https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/controltemplate?view=net-maui-9.0
https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/data-binding/compiled-bindings?view=net-maui-9.0#compiled-bindings-in-xaml

Page URL

https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/data-binding/compiled-bindings?view=net-maui-9.0

Content source URL

https://github.com/dotnet/docs-maui/blob/main/docs/fundamentals/data-binding/compiled-bindings.md

Document Version Independent Id

d8079bc8-3987-9069-717e-c5cbf3512ae1

Article author

@davidbritch

Metadata

  • ID: d8079bc8-3987-9069-717e-c5cbf3512ae1
  • Service: dotnet-mobile
  • Sub-service: dotnet-maui

Related Issues

@dotnetrepoman dotnetrepoman bot added the ⌚ Not Triaged Not triaged label Dec 3, 2024
@issues-automation issues-automation bot added dotnet-maui/subsvc dotnet-mobile/svc Pri1 High priority, do before Pri2 and Pri3 labels Dec 3, 2024
@MichaelLHerman MichaelLHerman changed the title TemplateBinding with CompiledBindings Addressing warnings on TemplateBinding with CompiledBindings on .NET 9 Dec 3, 2024
@MichaelLHerman MichaelLHerman changed the title Addressing warnings on TemplateBinding with CompiledBindings on .NET 9 Addressing warnings from CompiledBindings on .NET 9 on TemplateBinding Dec 3, 2024
@davidbritch
Copy link
Contributor

@MichaelLHerman
Copy link
Author

MichaelLHerman commented Dec 3, 2024

@davidbritch Looks like specifying x:DataType in the control template is all that needs to be done (though this should be documented somewhere). In the ControlTemplateDemos sample, I added the data type and the warnings went away.

<ControlTemplate x:Key="CardViewControlTemplate" x:DataType="controls:CardView">

@jfversluis
Copy link
Member

jfversluis commented Dec 12, 2024

Those changes are now in the samples as per this PR: dotnet/maui-samples#552

Does that help you any further?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-maui/subsvc dotnet-mobile/svc Pri1 High priority, do before Pri2 and Pri3 ⌚ Not Triaged Not triaged
Projects
None yet
Development

No branches or pull requests

3 participants