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

fix polygon/polyline load fail points within the template #12651

Conversation

a526684540
Copy link
Contributor

What does the pull request do?

use polygon in button's template,polygon invisible
i want fix polygon/polyline Unable to load points within the template.

What is the current behavior?

errorimage

What is the updated/expected behavior with this PR?

Dingtalk_20230824153410
polygon/polyline can load points within the template.

How was the solution implemented (if it's not obvious)?

Within the polygon constructor, “Points=new Points()”,BindingPriority is LocalValue;
When in the Template,loading points from xaml,BindingPriority is Template,so loading faild,the property points always the "new Points()";

Breaking changes

Obsoletions / Deprecations

Fixed issues

@a526684540
Copy link
Contributor Author

@dotnet-policy-service agree

@maxkatz6
Copy link
Member

maxkatz6 commented Aug 24, 2023

Thank you! But this PR introduces another bug.
With this PR PointsProperty will have single instance of the Points array as a default value. Meaning, the same array is going to be shared.

Probably, the better fix is to call SetValue(ProintsProperty, new Points(), BindingPriority.Template); from the ctor instead of Points = new Points.

@a526684540
Copy link
Contributor Author

I agree, your idea is better.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038746-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@robloo
Copy link
Contributor

robloo commented Aug 24, 2023

Note: This may fix #11560. That issue was originally noticed in a template. It wasn't tracked down fully since it was faster to work-around the issue with a Path.

@maxkatz6 maxkatz6 added this pull request to the merge queue Aug 25, 2023
Merged via the queue into AvaloniaUI:master with commit cf3491e Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants