Exemple #1
0
        internal static void UpdateMauiDrawable(this AView platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null;

            if (!hasBorder)
            {
                return;
            }

            MauiDrawable?mauiDrawable = platformView.Background as MauiDrawable;

            if (mauiDrawable == null)
            {
                mauiDrawable = new MauiDrawable(platformView.Context);

                platformView.Background = mauiDrawable;
            }

            if (border is IView v)
            {
                mauiDrawable.SetBackground(v.Background);
            }
            else
            {
                mauiDrawable.SetBackground(new SolidPaint(Colors.Transparent));
            }

            mauiDrawable.SetBorderShape(border.Shape);

            if (platformView is ContentViewGroup contentViewGroup)
            {
                contentViewGroup.Clip = border;
            }
        }
Exemple #2
0
        internal static void UpdateMauiDrawable(this AView nativeView, IBorder border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (!hasBorder)
            {
                return;
            }

            MauiDrawable?mauiDrawable = nativeView.Background as MauiDrawable;

            if (mauiDrawable == null)
            {
                mauiDrawable = new MauiDrawable(nativeView.Context);

                nativeView.Background = mauiDrawable;
            }

            mauiDrawable.SetBackground(border.Background);
            mauiDrawable.SetBorderBrush(border.Stroke);
            mauiDrawable.SetBorderWidth(border.StrokeThickness);
            mauiDrawable.SetBorderDash(border.StrokeDashPattern, border.StrokeDashOffset);
            mauiDrawable.SetBorderMiterLimit(border.StrokeMiterLimit);
            mauiDrawable.SetBorderLineJoin(border.StrokeLineJoin);
            mauiDrawable.SetBorderLineCap(border.StrokeLineCap);
            mauiDrawable.SetBorderShape(border.Shape);
        }
        internal static void UpdateMauiDrawable(this AView nativeView, IBorder border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (!hasBorder)
            {
                return;
            }

            MauiDrawable?mauiDrawable = nativeView.Background as MauiDrawable;

            if (mauiDrawable == null)
            {
                mauiDrawable = new MauiDrawable(nativeView.Context);

                nativeView.Background = mauiDrawable;
            }

            mauiDrawable.SetBackground(border.Background);
            mauiDrawable.SetBorderShape(border.Shape);
        }