Esempio n. 1
0
        void SetBorder(WStackLayout view)
        {
            if (view.BorderRadius > 0)
            {
                NativeView.Layer.CornerRadius = view.BorderRadius;
                NativeView.ClipsToBounds      = true;
                NativeView.BackgroundColor    = view.BackgroundColor.ToUIColor();
            }

            if (view.BorderWidth > 0)
            {
                NativeView.Layer.BorderWidth = view.BorderWidth;
            }

            if (view.BorderColor != Color.Default)
            {
                NativeView.Layer.BorderColor = view.BorderColor.ToUIColor().CGColor;
            }
        }
Esempio n. 2
0
        void SetBorder(WStackLayout view)
        {
            if (view.BorderRadius > 0 || view.BorderWidth > 0)
            {
                // creating gradient drawable for the curved background
                var _gradientBackground = new GradientDrawable();
                _gradientBackground.SetShape(ShapeType.Rectangle);
                _gradientBackground.SetColor(view.BackgroundColor.ToAndroid());

                // Thickness of the stroke line
                _gradientBackground.SetStroke(FDroidUtils.Dp(view.BorderWidth), view.BorderColor.ToAndroid());

                // Radius for the curves
                _gradientBackground.SetCornerRadius(FDroidUtils.Dp(view.BorderRadius));

                // set the background of the label
                ViewGroup.SetBackgroundColor(Color.Transparent.ToAndroid());
                ViewGroup.SetBackground(_gradientBackground);
            }
        }