private void UpdateCornerRadius(PancakeView pancake)
 {
     pancake.CornerRadius.Deconstruct(out double topLeft, out double topRight, out double bottomLeft, out double bottomRight);
     _borderRectangle.SetRadius(Forms.ConvertToScaledPixel(topLeft), Forms.ConvertToScaledPixel(topRight),
                                Forms.ConvertToScaledPixel(bottomLeft), Forms.ConvertToScaledPixel(bottomRight));
     _roundRectangle.SetRadius(Forms.ConvertToScaledPixel(topLeft), Forms.ConvertToScaledPixel(topRight),
                               Forms.ConvertToScaledPixel(bottomLeft), Forms.ConvertToScaledPixel(bottomRight));
     _roundRectangle.Draw();
     _borderRectangle.Draw();
 }
Esempio n. 2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Stepper> e)
        {
            if (Control == null)
            {
                var outter = new EBox(System.Maui.Maui.NativeParent)
                {
                    AlignmentX   = -1,
                    AlignmentY   = -1,
                    WeightX      = 1,
                    WeightY      = 1,
                    IsHorizontal = true,
                };
                outter.SetPadding(horizontalPadding, 0);
                outter.Show();
                outter.SetLayoutCallback(OnLayout);

                _borderL = new BorderRectangle(System.Maui.Maui.NativeParent);
                _borderL.Show();
                _borderL.SetRadius(radius);
                _borderL.BorderWidth = borderWidth;
                _borderL.Color       = defaultColor;

                _buttonL = new MButton(System.Maui.Maui.NativeParent)
                {
                    BackgroundColor = EColor.Transparent,
                    Text            = "<span color='#000000'>-</span>",
                };
                _buttonL.Show();

                _buttonL.Clicked += OnDecrementButtonClicked;

                outter.PackEnd(_borderL);
                outter.PackEnd(_buttonL);

                _borderR = new BorderRectangle(System.Maui.Maui.NativeParent);
                _borderR.Show();
                _borderR.SetRadius(radius);
                _borderR.BorderWidth = borderWidth;
                _borderR.Color       = defaultColor;

                _buttonR = new MButton(System.Maui.Maui.NativeParent)
                {
                    BackgroundColor = EColor.Transparent,
                    Text            = "<span color='#000000'>+</span>",
                };
                _buttonR.Show();

                _buttonR.Clicked += OnIncrementButtonClicked;

                outter.PackEnd(_borderR);
                outter.PackEnd(_buttonR);

                SetNativeView(outter);
            }

            UpdateValue();
            UpdateIncrement();
            UpdateMinimum();
            UpdateMaximum();

            base.OnElementChanged(e);
        }