14.0.0: Introducing Bindable Property Source Generators! #3054
Replies: 6 comments 12 replies
-
|
Hey @TheCodeTraveler, thanks so, so much for this! The bindable property source generator is going to be an absolute game changer. I've been playing with it and I've noticed a couple of problems. I've got a repo here: https://github.com/matt-goldman/MCTBPSG Should I open an issue (or issue) for these? Or discuss here or in a new discussion? Just want to check because it's still experimental, and your blog post specifically mentions using discussions. |
Beta Was this translation helpful? Give feedback.
-
|
Hello @TheCodeTraveler, Thank you so much for this feature — it's really cool! 🙌
and I had to add CS0436 to the NoWarn list to make everything build cleanly.
Just wanted to share — thanks again for the great work! |
Beta Was this translation helpful? Give feedback.
-
|
Any reason why CommunityToolkit.Maui.MediaElement v8.0.0 was not deployed to Nuget yet? |
Beta Was this translation helpful? Give feedback.
-
|
The |
Beta Was this translation helpful? Give feedback.
-
|
The |
Beta Was this translation helpful? Give feedback.
-
|
The [BindableProperty] sg sounds awesome, can't wait to try it. But please don't release this as a regular update if it depends on prerelease-libraries! The dependency on Microsoft.WindowsAppSDK >= 2.0.0-experimental3 breaks publish in a way that was (for me) pretty hard to detect. Still thanks for all the great work you do with this toolkit! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
CommunityToolkit.Maui v14.0.0I am excited to debut two new source generators!
[BindableProperty][AttachedBindableProperty<T>]These new source generators make it easier than ever to create a
BindablePropertyfor your .NET MAUI apps by allowing us to write all the associated boiler-plate code for you. In fact, all Bindable Properties inCommunityToolkit.Mauiare now automatically generated using these new source generators!For an in-depth overview of both
[BindableProperty]and[AttachedBindableProperty<T>], check out my comprehensive write-up:👉 https://codetraveler.io/introducing-bindable-property-source-generators/
Bug Fixes
Alongside the new Source Generators, this Release also brings important bug fixes:
StatusBarStatusBaron Android 35+PopupNavigatedFromEventArgsCollectionViewinPopupIntroducing Bindable Property Source Generators
Opt-into this Experimental Feature
We have decided to release this feature using the
[Experimental]attribute. This allows us to let you try out its features and provide feedback while giving us the flexibility to update it with your feedback over the next few releases.In the
csprojfile of your .NET MAUI app, add the following code:In the mean-time, we will be writing more comprehensive documentation and writing Analyzers, similar to
CommunityToolkit.MVVM, to help provide you the best coding experience!Using
[BindableProperty]To leverage the Bindable Property Source Generator, first ensure you using a
partialclass. Then, add thepartialkeyword and attach the[BindableProperty]attribute to your property:partialkeyword to the classpartialkeyword the Property for which to generate an associated Bindable Property[BindableProperty]attribute to the property to make it bindableThe above example generates the following Bindable Property:
For more in-depth examples see my comprehensive write-up on
[BindableProperty]:👉 https://codetraveler.io/introducing-bindable-property-source-generators/
Using
[AttachedBindableProperty<T>]Using [AttachedBindableProperty] is a bit different. This attribute is applied to either the Class or the Constructor, not a Property, as Attached Properties are not required to have an associated Property:
To leverage the Attached Bindable Property Source Generator, first ensure you using a
partialclass. Then, add[AttachedBindableProperty<T>]attribute to either the class or constructor:partialkeyword to the class[AttachedBindableProperty<T>]attribute to the class or constructor for which to generate an associated Attached PropertyAlternatively, the attribute can be attached to the constructor:
Both examples above generate the following Attached Property along with its associated Get/Set methods:
For more in-depth examples see my comprehensive write-up on
[AttachedBindableProperty<T>]:👉 https://codetraveler.io/introducing-bindable-property-source-generators/
What's Changed
ReferenceAssembliesExtensionsextension forReferenceAssemblies.Net.Net100by @TheCodeTraveler in [Housekeeping] AddReferenceAssembliesExtensionsextension forReferenceAssemblies.Net.Net100#2956[BindableProperty]Support for Additional Scenarios, AddCommunityToolkit.Maui.SourceGenerators.Internal.UnitTests, Implement[BindableProperty]for Behaviors by @TheCodeTraveler in Update[BindableProperty]Support for Additional Scenarios, AddCommunityToolkit.Maui.SourceGenerators.Internal.UnitTests, Implement[BindableProperty]for Behaviors #2932CommunityToolkit.Maui.SourceGenerator.Benchmarks, Reduce Memory Allocations on[BindableProperty]Source Generator by @TheCodeTraveler in AddCommunityToolkit.Maui.SourceGenerator.Benchmarks, Reduce Memory Allocations on[BindableProperty]Source Generator #2960[BindableProperty]for RatingView by @CliffAgius in Use[BindableProperty]for RatingView #2964[BindableProperty]for MediaElement by @ne0rrmatrix in Implement[BindableProperty]for MediaElement #2933[Experimental]To[BindableProperty]by @TheCodeTraveler in Add[Experimental]To[BindableProperty]#2990BindablePropertyAttribute.DefaultValueby @TheCodeTraveler in RemoveBindablePropertyAttribute.DefaultValue#2995Animationsto use [BindableProperty] partial properties by @ne0rrmatrix in RefactorAnimationsto use [BindableProperty] partial properties #3013[BindableProperties]partial properties by @ne0rrmatrix in Refactor Views to use[BindableProperties]partial properties #3017[BindableProperty]for Converters by @TheCodeTraveler in Implement[BindableProperty]for Converters #3018[BindableProperty]forImageSources, Add[BindableProperty]Support forinternalProperties by @TheCodeTraveler in Implement[BindableProperty]forImageSources, Add[BindableProperty]Support forinternalProperties #3019Copyinstead ofMovein FileSaver UI on iOS by @matt-goldman in UseCopyinstead ofMovein FileSaver UI on iOS #2981[BindableProperty]for ValidationBehaviors by @TheCodeTraveler in Implement[BindableProperty]for ValidationBehaviors #3000ReferenceAssembliesExtensionsby @TheCodeTraveler in RemoveReferenceAssembliesExtensions#3038[AttachedBindableProperty<T>]by @TheCodeTraveler in Create[AttachedBindableProperty<T>]#3024[AttachedBindableProperty<T>]and[BindableProperty]for Release by @TheCodeTraveler in Prepare[AttachedBindableProperty<T>]and[BindableProperty]for Release #3047New Contributors
Copyinstead ofMovein FileSaver UI on iOS #2981Full Changelog: 13.0.0...14.0.0
This discussion was created from the release 14.0.0: Introducing Bindable Property Source Generators!.
Beta Was this translation helpful? Give feedback.
All reactions