maui icon indicating copy to clipboard operation
maui copied to clipboard

Shadow does not honour Styles

Open jameslavery opened this issue 1 year ago • 2 comments
trafficstars

Description

If I use a Shadow, and update the appropriate Style in Styles.xaml, the shadow does not apply the properties set in the style.

For example, if I change the entry in Styles.xaml to have a Red brush:

    <Style
        TargetType="Shadow">
        <Setter Property="Radius" Value="15" />
        <Setter Property="Opacity" Value="0.5" />
        <Setter Property="Brush" Value="Red" />
        <Setter Property="Offset" Value="10,10" />
    </Style>

I would expect all Shadows to be red. They remain with their default colour.

Steps to Reproduce

  1. Create a new MAUI project.
  2. Amend the Style in Styles.xaml, with TargetType of "Shadow", to have a Red Brush.
  3. Add a Shadow to a control.
  4. The Shadow is not red when the application runs and renders the Shadow.

Link to public reproduction project repository

https://github.com/jameslavery/MauiShadowTestApp

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, Windows, I was not able test on other platforms

Affected platform versions

No response

Did you find any workaround?

No. Apart from setting the Shadow's attributes locally on each ContentPage/ContentView, thus not making use of Styles.

Relevant log output

No response

jameslavery avatar Dec 22 '23 13:12 jameslavery

Verified this on Visual Studio Enterprise 17.9.0 Preview 3(8.0.3). Repro on Windows 11, Android 14.0-API34, iOS 17.0 and MacCatalyst with below Project:

ShadowTestApp.zip image

XamlTest avatar Jan 23 '24 07:01 XamlTest

@jameslavery @samhouts The PR with a fix: https://github.com/dotnet/maui/pull/20203 :)

kubaflo avatar Jan 28 '24 01:01 kubaflo

Great work - thank you.

jameslavery avatar Jan 28 '24 08:01 jameslavery