Skip to content

[BUG] Padding and Margin are not applied to the Popup class of Popup2 by Style attribute #2747

@usausa

Description

@usausa

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

Margin and Padding are not applied to Popup in the Style attribute.
Property, the value is applied.

Expected Behavior

Margin and Padding are applied in the Style attribute as well as in the property.

Steps To Reproduce

  1. Create a Style to be applied to the Popup and set Padding and Margin.
  2. Apply Style to Popup

by Style

<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup
    x:Class="Popup2App.NoBorderPropertyPopup"
    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"
    Style="{StaticResource NoBorderPopup}"
    WidthRequest="200">

    <toolkit:Popup.Resources>
        <ResourceDictionary>
            <Style x:Key="NoBorderPopup" TargetType="toolkit:Popup">
                <Setter Property="Padding" Value="0" />
                <Setter Property="Margin" Value="0" />
                <Setter Property="BackgroundColor" Value="Blue" />
            </Style>
        </ResourceDictionary>
    </toolkit:Popup.Resources>

    <VerticalStackLayout>
        <Button Clicked="OnCloseClick" Text="Close" />
    </VerticalStackLayout>

</toolkit:Popup>

Image

  • by Property
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup
    x:Class="Popup2App.NoBorderStylePopup"
    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"
    Margin="0"
    Padding="0"
    BackgroundColor="Blue"
    WidthRequest="200">

    <VerticalStackLayout>
        <Button Clicked="OnCloseClick" Text="Close" />
    </VerticalStackLayout>

</toolkit:Popup>

Image

Link to public reproduction project repository

https://github.com/usausa/Issue-CommunityToolkitMaui-Popup2

Environment

- .NET MAUI CommunityToolkit: 12.0.0
- OS: Android
- .NET MAUI: 9.0.80

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