CommunityToolkit / CommunityToolkit/Maui

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

Open
#3,254 1 comment 0 reactions 0 assignees View on GitHub
known-issue
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

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

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### 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:

```

```

```
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

https://github.com/TheQffel/SampleApp

### Environment

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

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked SampleApp reproduction and the Popup margin and padding behavior described in the issue, then trace the corresponding Popup implementation in the CommunityToolkit.Maui source. Verify the behavior on Windows and Android with values of 0 and 0.00000001. Done means setting either property to 0 preserves 0 without reverting to the default 15.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.