private void UpdatePadding() { TimberLabel label = Element as TimberLabel; if (label == null) { return; } int left = ConversionHelpers.ConvertDPToPixels((int)label.Padding.Left + label.BorderWidth); int top = ConversionHelpers.ConvertDPToPixels((int)label.Padding.Top + label.BorderWidth); int right = ConversionHelpers.ConvertDPToPixels((int)label.Padding.Right + label.BorderWidth); int bottom = ConversionHelpers.ConvertDPToPixels((int)label.Padding.Bottom + label.BorderWidth); Control.SetPadding(left, top, right, bottom); }
protected override void OnLayout(bool changed, int l, int t, int r, int b) { base.OnLayout(changed, l, t, r, b); TimberLabel label = Element as TimberLabel; if (label == null) { return; } m_background.SetColor(label.BackgroundColor.ToAndroid()); int cornerRadiusPx = ConversionHelpers.ConvertDPToPixels(label.CornerRadius); m_background.SetCornerRadius(cornerRadiusPx); int borderWidthPx = ConversionHelpers.ConvertDPToPixels(label.BorderWidth); m_background.SetStroke(borderWidthPx, label.BorderColour.ToAndroid()); Background = m_background; }