[Bug] Popup does not respect Marigns when Stacklayout vertical layout options are set to expand
Description
When the main Stacklayout in the popup has VerticalOptions="StartAndExpand" and Margin="20", the layout ignores any margin spacing.

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 Could you attach a small repro?
Here is an example StackLayoutExample.zip
This certainly appears to be happy testing on MacCatalyst. @gktval what platform were you seeing this on?
Windows and Android last I checked
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.
I believe we can close this ticket.
cc: @brminnick
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.
@brminnick @vhugogarcia
Also not working on Android.
@brminnick
@vhugogarcia
@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 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.