Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame not using full width of the parent (StackLayout) when another element occupies the stack #13488

Open
npostma opened this issue Feb 21, 2023 · 2 comments
Labels
area-controls-frame Frame area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@npostma
Copy link

npostma commented Feb 21, 2023

Description

Hi,

I came across an issue with the Frame. If the frame has a HorizontalOptions start, and its content is long enough it wont use the full width. Changing start to startAndExpand does not have any effect. Removing the Border element form the StackLayout then the frame does us the full parent width. Only on iOS, android works as expected.

Shadow problems are reported under #13487

BugReport

Important to note that if i turn the shadows off, the problem still exists:

image

Steps to Reproduce

  1. Create a maui .net7 project (Not sure if this is also in .NET 6)
  2. Empty the project and make a simple empty page with a frame or a border element
  3. Give it a custom shadow with a gradient linear brush.

Styles.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<?xaml-comp compile="true" ?>
<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">

    <Shadow 
        x:Key="CustomShadow"
        Offset="0,75"
        >
        <Shadow.Brush>
            <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                <GradientStop Color="Green" Offset="1.0"/>
                <GradientStop Color="Red" Offset="0.5"/>
                <GradientStop Color="Blue" Offset="0.1"/>
            </LinearGradientBrush>
        </Shadow.Brush>
    </Shadow>

    <Style x:Key="FrameWithLongShadow" TargetType="Frame">
        <Setter Property="BackgroundColor" Value="White"/>
        <Setter Property="HeightRequest" Value="125"/>
        <Setter Property="CornerRadius" Value="5"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="VerticalOptions" Value="Start"/>
        <Setter Property="HorizontalOptions" Value="Start"/>
        <Setter Property="Shadow" Value="{DynamicResource CustomShadow}"/>
    </Style>

    <Style x:Key="BorderWithLongShadow" TargetType="Border">
        <Setter Property="BackgroundColor" Value="White"/>
        <Setter Property="HeightRequest" Value="125"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="VerticalOptions" Value="Start"/>
        <Setter Property="HorizontalOptions" Value="Start"/>
        <Setter Property="Shadow" Value="{DynamicResource CustomShadow}"/>
    </Style>

</ResourceDictionary>

MainPage.xml:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiShadowAndroidBug.MainPage">

        <StackLayout
            HorizontalOptions="CenterAndExpand"
            VerticalOptions="FillAndExpand" 
            BackgroundColor="Black" 
            Margin="0" 
            Padding="0">

            <Frame 
                Style="{DynamicResource FrameWithLongShadow}" 
                BackgroundColor="White">
                
                <Label Text="Hi, i am a frame with a long green to blue via red shadow. Do you see it?"></Label>
            </Frame>

            <Border
                Style="{DynamicResource BorderWithLongShadow}" 
                Margin="0,250,0,0"
                BackgroundColor="White">

            <Label Text="Hi, i am a border with a long green to blue via red shadow. Do you see it?"></Label>
        </Border>


    </StackLayout>

</ContentPage>

Or use my bug-demo repo.

Link to public reproduction project repository

https://github.com/npostma/bug_reports-MAUI_Shadows

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

Atleast iOS 16.2 and beyond

Did you find any workaround?

Not at this moment.

Relevant log output

No response

@npostma npostma added the t/bug Something isn't working label Feb 21, 2023
@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Feb 21, 2023
@rachelkang rachelkang added area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing platform/iOS 🍎 area-controls-frame Frame labels Feb 22, 2023
@rachelkang rachelkang added this to the Backlog milestone Feb 22, 2023
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Feb 22, 2023
@ghost
Copy link

ghost commented Feb 22, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jun 21, 2023
@XamlTest
Copy link

Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on Windows 11 with below Project:
bug_reports-MAUI_Shadows-main.zip

@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-frame Frame area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants