Skip to content

Update BindablePropertySourceGenerator to use partial properties#2835

Merged
TheCodeTraveler merged 10 commits intoCommunityToolkit:mainfrom
pictos:pj/update-sg
Aug 28, 2025
Merged

Update BindablePropertySourceGenerator to use partial properties#2835
TheCodeTraveler merged 10 commits intoCommunityToolkit:mainfrom
pictos:pj/update-sg

Conversation

@pictos
Copy link
Member

@pictos pictos commented Jul 29, 2025

Description of Change

Linked Issues

PR Checklist

Additional information

@pictos pictos requested review from a team and Copilot July 29, 2025 00:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Pedro Jesus and others added 5 commits August 9, 2025 20:08
bijington
bijington previously approved these changes Aug 28, 2025
Copy link
Collaborator

@TheCodeTraveler TheCodeTraveler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!! Thanks Pedro!

@TheCodeTraveler TheCodeTraveler merged commit 7675608 into CommunityToolkit:main Aug 28, 2025
11 checks passed
@pictos pictos deleted the pj/update-sg branch August 28, 2025 20:18
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Housekeeping] Update BindableProperty SG to use partial Properties

5 participants