Move default values into a style to support style overriding#2770
Move default values into a style to support style overriding#2770
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR moves the default property values for the Popup into a style so that they can be overridden, and adjusts the binding setups accordingly in both the Popup and PopupPage components.
- Default Popup property assignments now use a style added to the Popup’s Resources rather than inline assignments.
- Bindings in PopupPage.shared.cs have been updated to use statically imported property references.
- The sample App.xaml has been updated to demonstrate style overriding for Popup properties.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs | Updated binding calls to use statically imported properties instead of explicit Popup properties. |
| src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs | Removed redundant BindableProperty declarations and moved default value assignments into a newly created style. |
| samples/CommunityToolkit.Maui.Sample/App.xaml | Added setters for Popup styling to support style overriding. |
|
In fact I think this currently fails for |
TheCodeTraveler
left a comment
There was a problem hiding this comment.
Thanks Shaun! I hadn't considered Style when working on Popup v2 and boy was that a glaring mistake.
Is this PR ready, or does it need more work for implicit styles like you mentioned in your comment above?
I can't decide if the behaviour is correct or not. Currently the ImplicitStylePopup will fill full screen because it doesn't define a value for I am not thinking that this behaviour is correct because this implicit style overrides our implicit style in the toolkit - there can only be one implicit style to use right? |
…kit/Maui into feature/sl-fix-popup-style
We don't want it to fill the screen by default; it should be centered by default. I haven't had time to dig into the code - just a thought - this may be related to how we're propagating the
|
|
I really would like this change to be considered... |
Description of Change
I haven't fully tested this but from what I can see it certainly seems to solve the lack of Style support for the Popup properties. I suspect there may be a more efficient way to do this too, perhaps a single instance of the default style?
Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information