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

Border BoxShadow only works with BackgroundSizing=CenterBorder #15602

Open
amwx opened this issue May 4, 2024 · 4 comments
Open

Border BoxShadow only works with BackgroundSizing=CenterBorder #15602

amwx opened this issue May 4, 2024 · 4 comments

Comments

@amwx
Copy link
Contributor

amwx commented May 4, 2024

Describe the bug

Setting BackgroundSizing to anything other than CenterBorder causes the BoxShadow to not render:

image

To Reproduce

<StackPanel Orientation="Horizontal"
            Spacing="20"
            HorizontalAlignment="Center">

    <Border Background="Gray"
            Width="200" Height="200"
            BoxShadow="0 16 16 0 #35000000">
        <TextBlock Text="CenterBorder"
                   HorizontalAlignment="Center"/>
    </Border>

    <Border Background="Gray"
            Width="200" Height="200"
            BoxShadow="0 16 16 0 #35000000"
            BackgroundSizing="InnerBorderEdge">
        <TextBlock Text="InnerBorderEdge"
                   HorizontalAlignment="Center"/>
    </Border>

    <Border Background="Gray"
           Width="200" Height="200"
           BoxShadow="0 16 16 0 #35000000"
           BackgroundSizing="OuterBorderEdge">
        <TextBlock Text="OuterBorderEdge"
                   HorizontalAlignment="Center"/>
    </Border>
    
</StackPanel>

Expected behavior

No response

Avalonia version

11.1-beta1

OS

Windows

Additional context

No response

@amwx amwx added the bug label May 4, 2024
@amwx
Copy link
Contributor Author

amwx commented May 4, 2024

Related: #13251
Now that we have BackgroundSizing which draws via geometry (if not wanting the Skia default), it might be time to allow shadows on things that aren't just Rectangles

@robloo
Copy link
Contributor

robloo commented May 4, 2024

Hmm, I suspect there is a bit more going on here. I don't recall running across the box shadow code for the BackgroundSizing work. That said, I suspect the box shadow only ever worked with the simple rendering path.

@maxkatz6
Copy link
Member

maxkatz6 commented May 4, 2024

I suspect the box shadow only ever worked with the simple rendering path.

I am pretty sure that's the case.

Effects="drop-shadow(5 5 0 Green)" should still work with complex geometry. And we might be able to convert box shadow to drop shadow for complex borders.

@amwx
Copy link
Contributor Author

amwx commented May 5, 2024

Oh, I didn't know about the Effects API which is what along the lines of what I was thinking was needed. That works nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants