These are the changes I made upgrading this layout from Xamarin.Forms to .NET MAUI.
Grid
and stack layouts in .NET MAUI have 0 spacing by default, so anything I was inheriting from defaults in Xamarin.Forms was gone. I could have added that back as a base style, or as in this case I just added it where I saw I needed it.
I replaced PancakeView
, which is a jazzed up Frame
, and Frame
with Border
. Not only is it a .NET MAUI first class citizen by comparison, but it just behaves better. The one issue I found was that the logo image was clipped at the top by the Border
and I couldn't use the layout property to forego that. The solution was to move the image out of the Border
into the parent Grid
and located it above by moving it down in the file.
I was able to reduce a few instances of nested controls. For example I had PancakeView
> Grid
> Label
in Xamarin.Forms, and was able to just do Border
> Label
in .NET MAUI. I also had a Grid
> BoxView
+ Label
that I replaced with Border
> Label
to get the discount to display with the rounded corners.
On Android using Grid
margin inside a Border
clips the contents that are meant to be visible with a negative margin, despite the IsClippedToBound="False"
. To adjust for this I switched from using margin on the inner Grid
to padding, and then the negative margin to pull the children into that space.
UI replicated in Xamarin Forms. For more information about, you can enter to my blog https://askxammy.com
⚠ Design obteined from Dribble. -> https://dribbble.com/shots/14274577/attachments/5925600?mode=media