Popup V2 - Move PopupOptions Settings Into XAML #2742
Replies: 4 comments 8 replies
-
The suggestion of using attached properties was based around the concept that you do not need to subclass from Popup in order to display something in a Popup - it can be a simple ContentView, etc. If you want to define those properties in this XAML then it would need to be an attached property |
Beta Was this translation helpful? Give feedback.
-
Oh, and i meant to ask, is there a guide for migrating from the old to new popup anywhere? |
Beta Was this translation helpful? Give feedback.
-
I agree that's what a user should do with these attached properties, alas you have to code for the case where they do it wrong. In practice I suspect the vast majority of cases will simply define a popup in XAML so as to have access to The guide seems very thorough, I wish I'd read it before attempting my conversion, so my first comment is that it would be helpful to make its existence more obvious (though there may be some terribly obvious place I missed), perhaps add a pointer to it alongside the other It may be worth mentioning that Margin and Padding have non-zero default values. I'm not sure if it is useful, but because I prefer to have my UI in XAML I've settled on setting BackgroundColor="Transparent"
Margin="0"
Padding="0" In the In the Removed The need to Subclass Popup section one might also want to use the I didn't understand the comment under the PopupOptions header that said, Note that each of the following properties are BindableProperty definitions.... Bindable properties on As is often the case in this sort of dialogue, it's easy to lose sight of the fact that this is a terribly useful implementation which, overall, works very well. While I might quibble with the details, the big picture is an excellent one, my thanks to all who participated in making it happen. |
Beta Was this translation helpful? Give feedback.
-
This discussion is very helpful. Thank you both @david-maw @bijington |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The
PopupOptions
mechanism moves a certain amount of popup formatting into the caller's code rather than the XAML (or C#) for the popup itself as it formerly was.Moving the control of formatting into XAML would make UI design easier because XAML updates can be visualized fairly easily. Making the properties bindable makes it more flexible and XAML makes some things (like styling and responding to Themes for example) a lot easier. It would also centralize control of the popup appearance and behavior in the popup itself, which seems less error prone than splitting it between the caller and the popup.
This suggestion is that the setting in
PopupOptions
be turned into bindable properties of the Popup class. Some (CanBeDismissedByTappingOutsideOfPopup
,PageOverlayColor
andShadow
) could be simple bindable properties andShape
would need to be split into the set of propertiesBorder
uses to define the outline (StrokeShape
,StrokeThickness
etc.). Options provided in aShowPopupAsync
call would override values provided in XAML.You could use attached properties for this, but that seems fraught with complexity for no great gain over simple bindable properties on
Popup
.Beta Was this translation helpful? Give feedback.
All reactions