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

GradientBrushes are not supported on Shape.Stroke #21983

Open
crhalvorson opened this issue Apr 22, 2024 · 1 comment · May be fixed by #22208
Open

GradientBrushes are not supported on Shape.Stroke #21983

crhalvorson opened this issue Apr 22, 2024 · 1 comment · May be fixed by #22208
Labels
area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@crhalvorson
Copy link

Description

When applying a Linear or Radial Gradient Brush to the Stroke property of a Shape (Path, or one of the prebuilt shapes such as Ellipse), the color applied to the Stroke is only the first color defined in the gradient as if it were a SolidColorBrush. A GradientBrush in a Fill or Background has worked as expected.

I could not find a place where this was specifically documented (and this was working in Xamarin.Forms) so I am logging this as a bug. I did find some potentially related issues but they did not specifically address the issue of a gradient on the Stroke property.

Screenshot from the repro app linked below:
image

I found this on MAUI 8.0.7 but tested 8.0.20 as well.

Steps to Reproduce

  1. Create a new .NET MAUI App
  2. Define a LinearGradient with distinct colors
  3. Create an Ellipse and set it with sufficient border/stroke thickness to be able to see the change in gradient. Use the same gradient for Fill and Stroke
  4. Note that the gradient is applied to the Fill, but not the Stroke

Link to public reproduction project repository

https://github.com/crhalvorson/MauiPathGradientRepro

Version with bug

8.0.20 SR4

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

iOS 17.2, Android 14

Did you find any workaround?

Border.Stroke supports a GradientBrush and can accept a StrokeShape that contains a Path or other shape (see reproduction repo for an example).

Relevant log output

No response

@crhalvorson crhalvorson added the t/bug Something isn't working label Apr 22, 2024
@RoiChen001
Copy link
Collaborator

RoiChen001 commented Apr 23, 2024

Can repro this issue at Android platform at the latest 17.10.0 preview 4(8.0.7&8.0.20).

@RoiChen001 RoiChen001 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 23, 2024
@PureWeen PureWeen added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Apr 23, 2024
@Eilon Eilon added the area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing label Apr 30, 2024
@kubaflo kubaflo linked a pull request May 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants