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/100 46 rounded box view border corner #108

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void UpdateBorder(this View nativeControl, Color color, int thickn

if (backgroundGradient != null)
{
var relativeBorderThickness = thickness*3;
var relativeBorderThickness = (int)System.Math.Round(Xamarin.Forms.Forms.Context.ToPixels(thickness)); //#46
backgroundGradient.SetStroke(relativeBorderThickness, color.ToAndroid());
}
}
Expand All @@ -75,7 +75,7 @@ public static void UpdateCornerRadius(this View nativeControl, double cornerRadi

if (backgroundGradient != null)
{
var relativeCornerRadius = (float) (cornerRadius*3.7);
var relativeCornerRadius = Xamarin.Forms.Forms.Context.ToPixels(cornerRadius); //#46
backgroundGradient.SetCornerRadius(relativeCornerRadius);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE

this.UpdateFrom(_formControl, e.PropertyName);
}

public override void SetBackgroundColor(Android.Graphics.Color color)
{
//Fix for #100, will prevent background from getting overriden on BackgroundColor property changed by Forms.
//Alternative fix would be to check propertyname in OnElementPropertyChanged, and skip if it's BackgroundColor.
// if(e.PropertyName != nameof(VisualElement.BackgroundColor))
// base.OnElementPropertyChanged(sender, e);
}
}
}