-
Notifications
You must be signed in to change notification settings - Fork 207
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
Compiled Bindings in Code Are No Longer Available and Documentation Update Needed #2729
Comments
Hi @WolfgangPhy Compiled bindings in code are still supported. What happens is that a source generator creates a |
Hi @davidbritch, Thank you for your quick response and for clarifying how the source generator works to create the SetBinding method at build time. I understand that this process supports compiled bindings in code, and I appreciate you pointing me to the generated code location. However, I’d like to confirm something: does using SetBinding in a basic example like this:
automatically generate a compiled binding? I ask because the version shown in the documentation, such as:
doesn’t seem to work as expected. Given this, is my issue about the documentation being outdated still valid? Thank you again for your time and help! |
No. It only generates a compiled binding if you use a
The page about compiled bindings is accurate. However, most of the other docs are not yet using compiled bindings. In December I went through all of the MAUI samples (in dotnet/maui-samples) and replaced the bindings with compiled bindings. The next job is to go through all the docs and ensure that every binding expression uses a compiled binding (see the issues at https://github.com/dotnet/docs-maui/issues?q=is%3Aissue%20state%3Aopen%20compiled-bindings). |
I genuinely have great respect for your work, which is incredibly important and necessary. Knowing that someone is actively addressing this is truly encouraging. I wish you the best of luck in your future endeavors. Regarding the solution you provided, does it only work with .NET 9? It seems that the |
Yes. .NET 9 only. |
So there is no Compiled Bindings in code for.NET 8 ? |
Correct. In .NET 8 there are compiled bindings in XAML, but not in code. .NET 9 has forced the issue due to the introduction of the trimmer, which will remove string-based bindings from your app (when full trimming is used). |
Ok thank you ! So i close this issue ! |
Type of issue
Typo
Description
Based on the following code snippet:
Source
It appears that compiled bindings in code are no longer supported or functional. This change affects how bindings are utilized programmatically.
As a result, the related class documentation also needs to be updated to reflect this change:
Class documentation
This discrepancy between the code behavior and the documentation might lead to confusion for developers relying on this feature.
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
Related Issues
The text was updated successfully, but these errors were encountered: