Only set button borders if needed

This commit is contained in:
Frank A. Krueger 2017-11-09 17:50:19 -08:00
parent a3afe816a7
commit 0ccb07ab5e
1 changed files with 17 additions and 2 deletions

View File

@ -76,9 +76,24 @@ namespace Ooui.Forms.Renderers
if (button.BorderColor != Xamarin.Forms.Color.Default) if (button.BorderColor != Xamarin.Forms.Color.Default)
uiButton.Style.BorderColor = button.BorderColor.ToOouiColor (); uiButton.Style.BorderColor = button.BorderColor.ToOouiColor ();
else
uiButton.Style.BorderColor = null;
uiButton.Style.BorderWidth = Math.Max (0f, (float)button.BorderWidth); float bw = Math.Max (0f, (float)button.BorderWidth);
uiButton.Style.BorderRadius = button.BorderRadius; if (bw > 0) {
uiButton.Style.BorderWidth = bw + "px";
}
else {
uiButton.Style.BorderWidth = null;
}
var br = button.BorderRadius;
if (br > 0 && (bw > 0 || br != 5)) { // 5 is the default
uiButton.Style.BorderRadius = br + "px";
}
else {
uiButton.Style.BorderRadius = null;
}
} }
void UpdateFont () void UpdateFont ()