Skip to content

[BUG] Popup - Margin & Padding - Cannot set to 0 #3254

Description

@TheQffel

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Cannot set margin and padding to 0, when is set to very small value like 0.00000001 it works, but if set to 0 it goes back to default 15.

Expected Behavior

Setting margin and padding to 0 really sets it to 0.

Steps To Reproduce

Create fullscreen popup (by setting width and height to page size) and set margin and padding to 0. Example:

<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
               xmlns:local="clr-namespace:Mobile"
               BackgroundColor="#888"
               x:Class="Mobile.SideMenu"
               Padding="0.00000001"
               Margin="0.00000001">

</toolkit:Popup>
    partial class SideMenu : Popup
    {
        public SideMenu()
        {
            InitializeComponent();

            Application.Current!.Windows[0].Page!.SizeChanged += AdjustSize;

            Layout.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => { CloseAsync(); }) });

            AdjustSize(this, new EventArgs());
        }

        private void AdjustSize(object? sender, EventArgs e)
        {
            WidthRequest = Application.Current!.Windows[0].Page!.Width;
            HeightRequest = Application.Current!.Windows[0].Page!.Height;
        }
    }

Link to public reproduction project repository

.

Environment

- .NET MAUI CommunityToolkit: 14
- OS: Windows / Android
- .NET MAUI: 10

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions