maui
maui copied to clipboard
Shadow does not honour Styles
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
- Create a new MAUI project.
- Amend the Style in Styles.xaml, with TargetType of "Shadow", to have a Red Brush.
- Add a Shadow to a control.
- 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
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:
@jameslavery @samhouts The PR with a fix: https://github.com/dotnet/maui/pull/20203 :)
Great work - thank you.