-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
TemplateBinding with CornerRadius on Border does not work anymore #21747
Comments
We run into the exact same issue that our Regression issue:
We see this issue on all our supported platforms
|
@omghb can you please attach a repro? |
If I make the entire |
Looks like this change: https://github.com/dotnet/maui/pull/21151/files#r1523373115 Seems that we used to: AddLogicalChild(visualElement); Now we SetInheritedBindingContext(visualElement, BindingContext); This makes sense as the stroke is not meant to be a "child" of the border, but rather is just a set of values. |
Seems that this is broken now that we are no longer making the shape a CHILD, and as a result, it never gets the PARENT that is used here: maui/src/Controls/src/Core/TemplateUtilities.cs Lines 11 to 33 in 7f85d2a
Basically, the templating system ONLY looks up the parent-child path, and we have removed the shape from that path. |
@PureWeen @StephaneDelcroix was the change in #21151 to no longer parent the shape the correct one? If it was correct, should there be an alternate path for non-parented-but-still-logical-children? Is that just the normal logical children and there is a flaw in the way the logical/virtual child trees are being re-used? |
In this change: https://github.com/dotnet/maui/pull/21151/files#r1523373115 Thoughts?, Ideas? For example, use a weak reference to set the parent, and also implement x:Shared Attribute - XAML | Microsoft Learn |
Using maui/src/Controls/src/Core/Setter.cs Line 78 in 994117b
|
This comment was really good a few months* ago and come with two solutions, we applied one, what do you think of the second one? (Solution B): |
Follow up of my comment above. We can introduce a new interface: public interface IStyleSetterValueProvider {
object ProvideValue();
} This interface would be explicitly implemented in When Well, we can find better names, I just wanted to give an idea. |
Thank you very much for your help. The Template Binding with CornerRadius works again with MAUI version 8.0.60. But I’m sorry, I have a new CornerRadius issue with GradientDrawable on Android. Please see: |
Description
Hi all,
I use my own Button control inherited from TemplatedView; with a CornerRadius property.
In the button’s ControlTemplate I have a Border with a RoundRectangle StrokeShape and a TemplateBinding to the before mentioned CornerRadius property.
And I have a Style to set the CornerRadius property.
After updating to MAUI 8.0.20 this doesn’t work anymore – tested on Android. The button in the UI doesn’t have round corners anymore. If I remove the TemplateBinding and set the CornerRadius in the ControlTemplate directly, it works again.
I can live with this work around for the moment. Thank you very much for reading.
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.20 SR4
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.14 SR3.1
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: