Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[Bug] Popup does not respect Marigns when Stacklayout vertical layout options are set to expand

Open gktval opened this issue 3 years ago • 2 comments

Description

When the main Stacklayout in the popup has VerticalOptions="StartAndExpand" and Margin="20", the layout ignores any margin spacing.

image

If VerticalOptions="Start", then issues similar to this happen: https://github.com/CommunityToolkit/Maui/issues/388 (the layout is not fully utilized) except that any VerticalOptions="End" are ignored.

Link to Reproduction Sample

Example Xaml code for popup:

<StackLayout  Orientation="Vertical" Margin="20" BackgroundColor="Gray">
        <StackLayout Orientation="Vertical" VerticalOptions="StartAndExpand">
            <Label Text="Workspace" HorizontalOptions="Center" FontSize="Title" />
            <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
                <Label HorizontalOptions="FillAndExpand" />
                <ImageButton Source="dotnet_bot.png" HeightRequest="36" HorizontalOptions="End" />
            </StackLayout>
            <StackLayout  >
                <Picker Title="Select a root path" x:Name="RootPathPicker"/>
            </StackLayout>
        </StackLayout>
        <StackLayout Spacing="10">
            <Button x:Name="okBtn" Text="OK" Command="{Binding OKCommand}"/>
            <Button x:Name="cancelBtn" Text="Cancel" Command="{Binding CancelCommand}" />
        </StackLayout>
    </StackLayout>

Expected Behavior

Margins around the inside of popup

Actual Behavior

Margins are ignored

gktval avatar Aug 31 '22 18:08 gktval

@gktval Could you attach a small repro?

pictos avatar Aug 31 '22 19:08 pictos

Here is an example StackLayoutExample.zip

gktval avatar Aug 31 '22 20:08 gktval

This certainly appears to be happy testing on MacCatalyst. @gktval what platform were you seeing this on?

Screenshot 2023-05-06 at 13 25 08

bijington avatar May 06 '23 12:05 bijington

Windows and Android last I checked

gktval avatar May 06 '23 13:05 gktval

I am unable to reproduce this issue. I tested it on Android and iOS. This error was reported on .NET MAUI 6 using .NET MCT 1.0.x , I upgraded the sample to .NET MAUI 7 and .NET MCT 6.0.0 and the margins and layout options are working as expected.

Screenshot_1698775624

I believe we can close this ticket.

cc: @brminnick

vhugogarcia avatar Oct 31 '23 18:10 vhugogarcia

I wouldn't be so fast at closing this. Based on the demo I provided above. It still has issues in .Net 8 and the latest version of community toolkit.

image

@brminnick @vhugogarcia

gktval avatar Oct 31 '23 18:10 gktval

Also not working on Android.

image @brminnick @vhugogarcia

gktval avatar Oct 31 '23 18:10 gktval

@gktval could you please define exactly what is not working on the samples above? I shared an Android screenshot previously showing the Margins and Paddings working as expected.

If what you are looking for is a space inside the Popup around your controls you should use Padding in your StackLayout. The margins are set for outside of the container. 😃

vhugogarcia avatar Oct 31 '23 19:10 vhugogarcia

@vhugogarcia Padding does apply the border. Thanks! The only other issue I see is in Windows. The height of the contents in the stack layout are ignored. This happens when you apply padding. Maybe padding height is not applied to the entire height of the content.

image

gktval avatar Oct 31 '23 19:10 gktval