CornerRadius issue with MaterialContentView in CollectionView on Android
See original GitHub issueThe CornerRadius of MaterialContentView is not working properly when using it in a CollectionView. The bug is only on Android. No issue on iOS. Version 2.1.0-beta1 (androidx) with most recent version of xamarin forms.
Here is a sample repro project. repro.zip
Here is a screen record of both actual and expected behavior.
I think the issue is in XamarinBackgroundKit.Android.PathProviders.RoundRectPathProvider
.
The CanHandledByOutline
method uses CornerRadii
, but it does not seem to hold the correct value when IsPathDirty==true
.
https://github.com/ChasakisD/Xamarin.Forms.BackgroundKit/blob/4e7c51bcdaae90f738a0f220d520f97a8d49c69a/src/XamarinBackgroundKit.Android/PathProviders/RoundRectPathProvider.cs#L16
So here is a fix that works in my scenario. Instead of:
public override bool CanHandledByOutline =>
Math.Abs(CornerRadii.Sum() / CornerRadii.Length - CornerRadii[0]) < 0.0001;
check the value of IsPathDirty first:
public override bool CanHandledByOutline =>
!IsPathDirty && Math.Abs(CornerRadii.Sum() / CornerRadii.Length - CornerRadii[0]) < 0.0001;
What do you think ? Thanks !
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top GitHub Comments
@tranb3r Version 2.1.2 released to nuget. Thank you very much!
Merged the androidx branch