Skip to content

Border shadow not rendered correctly #19312

@pikausp

Description

@pikausp

Description

Different combinations of border placement and background color produce different-looking shadows.

Steps to Reproduce

Tested the following combinations

  • Border without background inside a scrollview
  • Border without background inside grid inside a scrollview
  • Border without background
  • Border with background inside a scrollview
  • Border with background inside grid inside a scrollview
  • Border with background

image

<?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="ShadowInsideScrollView.MainPage">
    <ContentPage.Resources>

        <Style TargetType="Border">
            <Setter Property="Margin"
                    Value="20" />
            <Setter Property="StrokeShape"
                    Value="{RoundRectangle CornerRadius=20}" />
            <Setter Property="Shadow">
                <Setter.Value>
                    <Shadow Brush="Black"
                            Offset="20,20"
                            Radius="10"
                            Opacity="1"/>
                </Setter.Value>
            </Setter>
        </Style>
    </ContentPage.Resources>

    <Grid RowDefinitions="*, *, *, *, *, *"
          RowSpacing="10">
        <ScrollView>
            <Border />
        </ScrollView>

        <ScrollView Grid.Row="1">
            <Grid>
                <Border />
            </Grid>
        </ScrollView>

        <Border Grid.Row="2" />

        <ScrollView Grid.Row="3">
            <Border BackgroundColor="White" />
        </ScrollView>

        <ScrollView Grid.Row="4">
            <Grid>
                <Border BackgroundColor="White" />
            </Grid>
        </ScrollView>

        <Border BackgroundColor="White"
                Grid.Row="5"/>
    </Grid>

</ContentPage>

Link to public reproduction project repository

https://github.com/pikausp/ShadowInsideScrollView

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 14

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-borderBorderarea-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingdelightermigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/androids/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions