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

[Windows] Not render shadows on without a ShadowColor #6191

Merged
merged 3 commits into from
Apr 25, 2022
Merged

Conversation

jsuarezruiz
Copy link
Contributor

@jsuarezruiz jsuarezruiz commented Apr 18, 2022

Description of Change

This PR is related with the issue 5820, but actually, that issue had two different issues. On the one hand, the Shadow applied to the Border was not rendered on Android and on the other hand, the shape is not quite correct.

What happens:

  • By default, Shadow does not have any color.
  • But on Windows, a shadow is rendered as black even though the color is null.

This PR adds the following changes:

  • A Shadow is not rendered if shadow color is null on Windows.
  • The Shadow uses a SolidColorBrush with the color black by default. This way using <Shadow /> with the default properties renders a black shadow around the View on all platforms.

Fixes ##5820

@jsuarezruiz jsuarezruiz added t/bug Something isn't working platform/windows 🪟 area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing labels Apr 18, 2022
@@ -8,7 +8,7 @@ public class Shadow : Element, IShadow

public static readonly BindableProperty OpacityProperty = BindableProperty.Create(nameof(Opacity), typeof(float), typeof(Shadow), 1f);

public static readonly BindableProperty BrushProperty = BindableProperty.Create(nameof(Brush), typeof(Brush), typeof(Shadow), null);
public static readonly BindableProperty BrushProperty = BindableProperty.Create(nameof(Brush), typeof(Brush), typeof(Shadow), Brush.Black);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default Shadow Brush becomes a black SolidColorBrush.

@@ -164,7 +164,7 @@ void DisposeShadow()

async Task CreateShadowAsync()
{
if (Child == null || Shadow == null)
if (Child == null || Shadow == null || Shadow.Paint == null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid render shadows on Windows if the ShadowColor property is null.

@jsuarezruiz
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

float opacity = 0;
var shadowColor = Graphics.Colors.Transparent;
var offset = new Graphics.Point(1, 1);
float blurRadius = 10f;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default Values.

@Redth Redth merged commit 7985243 into main Apr 25, 2022
@Redth Redth deleted the fix-5820-I branch April 25, 2022 18:45
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@samhouts samhouts added the fixed-in-6.0.300-rc.3 Look for this fix in 6.0.300-rc.3! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing fixed-in-6.0.300-rc.3 Look for this fix in 6.0.300-rc.3! platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants