Skip to content

Bindable property for Popup#2991

Merged
TheCodeTraveler merged 10 commits intoCommunityToolkit:mainfrom
ne0rrmatrix:UpdatePopupBindableProperties
Dec 11, 2025
Merged

Bindable property for Popup#2991
TheCodeTraveler merged 10 commits intoCommunityToolkit:mainfrom
ne0rrmatrix:UpdatePopupBindableProperties

Conversation

@ne0rrmatrix
Copy link
Member

@ne0rrmatrix ne0rrmatrix commented Dec 6, 2025

Description of Change

This pull request refactors how bindable properties are defined and used in the Popup and PopupOptions classes. Instead of manually declaring backing BindableProperty fields and property wrappers, it leverages the [BindableProperty] attribute to auto-generate these properties, resulting in cleaner and more maintainable code. Additionally, the XML documentation for properties has been improved for clarity.

Refactoring of bindable properties:

  • Replaced manual BindableProperty declarations and property wrappers in Popup (Popup.shared.cs) with auto-generated properties using the [BindableProperty] attribute for Margin, Padding, HorizontalOptions, VerticalOptions, and CanBeDismissedByTappingOutsideOfPopup.
  • Similarly, updated PopupOptions (PopupOptions.shared.cs) to use [BindableProperty] for CanBeDismissedByTappingOutsideOfPopup, OnTappingOutsideOfPopup, PageOverlayColor, Shape, and Shadow, removing manual property logic.

Documentation improvements:

  • Enhanced XML documentation comments for bindable properties in both Popup and PopupOptions to be more descriptive and consistent. [1] [2]

Code cleanup:

  • Removed redundant property wrappers and backing fields that are no longer necessary due to the use of auto-generated bindable properties. [1] [2]

General:

  • Added missing using System.ComponentModel; directive to support the [BindableProperty] attribute.

PR Checklist

Additional information

Not sure if using a static object is best approach but it works. I am hoping for input on whether to use that or if anyone has any better ideas?

Replaced manual BindableProperty implementations with the
BindableProperty attribute in the `Popup` and `PopupOptions`
classes. This simplifies property definitions, reduces boilerplate,
and improves code readability.

Updated properties such as `Margin`, `Padding`, `HorizontalOptions`,
and `VerticalOptions` in `Popup`, and `CanBeDismissedByTappingOutsideOfPopup`,
`OnTappingOutsideOfPopup`, `PageOverlayColor`, `Shape`, and `Shadow`
in `PopupOptions` to use the attribute with default value creators.

Removed redundant manual property implementations as they are now
handled by the BindableProperty attribute.
Copilot AI review requested due to automatic review settings December 6, 2025 15:19
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 pull request refactors the Popup and PopupOptions classes to use the [BindableProperty] attribute for auto-generating bindable properties instead of manually declaring them. While the intent to modernize the code is good, there are several critical bugs that prevent this code from working correctly.

Key Changes:

  • Replaced manual BindableProperty declarations with [BindableProperty] attributes in both Popup and PopupOptions classes
  • Improved XML documentation for better clarity
  • Removed redundant property wrappers and backing fields

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs Added using System.ComponentModel;, converted 5 properties to use [BindableProperty] attribute with default value creators, and removed manual property implementations
src/CommunityToolkit.Maui/Views/Popup/PopupOptions.shared.cs Converted 5 properties to use [BindableProperty] attribute with default value creators and removed manual property implementations

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 6, 2025 16:37
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

ne0rrmatrix and others added 2 commits December 6, 2025 08:43
Updated the `CanBeDismissedByTappingOutsideOfPopup` property to use a `DefaultValueCreatorMethodName` for dynamic default value resolution. Added the `CreateCanBeDismissedByTappingOutsideOfPopup` method to provide the default value at runtime, improving flexibility and reducing reliance on hardcoded defaults.
Copilot AI review requested due to automatic review settings December 11, 2025 21:17
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings December 11, 2025 21:32
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings December 11, 2025 21:44
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 11, 2025 21:44
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

Thanks James! FYI - I went ahead and updated the [BindableProperty]s to use partial property initializers

@TheCodeTraveler TheCodeTraveler merged commit a4b3339 into CommunityToolkit:main Dec 11, 2025
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 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.

3 participants