Update BindablePropertySourceGenerator to use partial properties#2835
Merged
TheCodeTraveler merged 10 commits intoCommunityToolkit:mainfrom Aug 28, 2025
Merged
Update BindablePropertySourceGenerator to use partial properties#2835TheCodeTraveler merged 10 commits intoCommunityToolkit:mainfrom
TheCodeTraveler merged 10 commits intoCommunityToolkit:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the BindablePropertySourceGenerator to utilize C#'s partial properties feature, transitioning from class-level to property-level attribute application. The change modernizes the code generation pattern by allowing developers to declare bindable properties directly on partial properties rather than using class-level attributes.
Key changes:
- Modified the BindablePropertyAttribute to target properties instead of classes
- Updated the source generator to process property-level attributes and generate corresponding BindableProperty fields
- Refactored the Expander class to demonstrate the new partial property syntax
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Expander.shared.cs | Converted class-level BindableProperty attributes to partial property declarations with property-level attributes |
| AttributeExtensions.cs | Enhanced constructor argument handling to support optional parameters with placeholders |
| BindablePropertyAttributeSourceGenerator.cs | Completely refactored to process property-level attributes and generate code for partial properties |
src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
chewie1234
approved these changes
Aug 10, 2025
bijington
previously approved these changes
Aug 28, 2025
TheCodeTraveler
approved these changes
Aug 28, 2025
Collaborator
TheCodeTraveler
left a comment
There was a problem hiding this comment.
This is awesome!! Thanks Pedro!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information