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

Invalidate shapes changing any property inside the brushes (Fill, Stroke) #13905

Merged
merged 17 commits into from
Mar 21, 2023

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Invalidate shapes changing any property inside the brushes (Fill, Stroke).

fix-13891

image

Issues Fixed

Fixes #13891

@jsuarezruiz jsuarezruiz added t/bug Something isn't working area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor labels Mar 14, 2023
@github-actions
Copy link
Contributor

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@github-actions
Copy link
Contributor

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@jsuarezruiz
Copy link
Contributor Author

jsuarezruiz commented Mar 16, 2023

@jonathanpeppers
I've added more changes because the proxy we used to detect brush changes in Shapes required to detect changes from other events (changes in brush gradientstops etc.). I have also added a new example to validate this.
image

Could you review it again?. Thanks!

Comment on lines 56 to 57
stroke.Color = Colors.Green;
Assert.True(fired, "PropertyChanged did not fire!");
Copy link
Member

Choose a reason for hiding this comment

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

I think I found an issue in this pattern, if you change this to:

Suggested change
stroke.Color = Colors.Green;
Assert.True(fired, "PropertyChanged did not fire!");
await Task.Yield();
GC.Collect();
GC.WaitForPendingFinalizers();
stroke.Color = Colors.Green;
Assert.True(fired, "PropertyChanged did not fire!");

Does it fail? I found saving some delegates in a member variable fixes it, but looking how we can do it in a nicer way.

Copy link
Member

Choose a reason for hiding this comment

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

Follow what I did here to get the above test to pass: #13997

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, the test was not passing in that case.
Applied changes to save the EventHandlers in a member field.

image
Now are passing (at least locally).

@jsuarezruiz jsuarezruiz merged commit 8b6ba5b into main Mar 21, 2023
@jsuarezruiz jsuarezruiz deleted the fix-13891 branch March 21, 2023 15:00
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2023
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 legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor t/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing properties of Shape.Stroke brush does not update app rendering
3 participants