Beispiel #1
0
        public void SetGradientLayer(LiteForms.Color from, LiteForms.Color to)
        {
            var gradientLayer = new CoreAnimation.CAGradientLayer();

            gradientLayer.Colors = new CoreGraphics.CGColor[] {
                from.ToCGColor(), to.ToCGColor()
            };
            gradientLayer.StartPoint = new CoreGraphics.CGPoint(0.0, 0.5);
            gradientLayer.EndPoint   = new CoreGraphics.CGPoint(1.0, 0.5);

            //var shapeLayer = new CoreAnimation.CAShapeLayer();
            //shapeLayer.Path = AppKit.NSBezierPath.FromRect(this.nativeView.Bounds).ToCGPath();
            //shapeLayer.FillColor = AppKit.NSColor.Clear.CGColor;
            //shapeLayer.StrokeColor = AppKit.NSColor.Clear.CGColor;
            //gradientLayer.Mask = shapeLayer;

            //var borderWidth = BorderWidth;
            //var borderColor = BorderColor;
            //var borderRadius = BorderRadius;

            this.nativeView.Layer = gradientLayer;

            //BorderWidth = borderWidth;
            ////BorderColor = borderColor;
            //BorderRadius = borderRadius;
        }
        public void SetGradient()
        {
            gradLayer?.RemoveFromSuperLayer();

            var xfButton    = Element as Button;
            var colorTop    = xfButton.BackgroundColor;
            var colorBottom = Color.Black;

            gradLayer = Gradient.GetGradientLayer(colorTop.ToCGColor(), colorBottom.ToCGColor(), (float)xfButton.Width, (float)xfButton.Height);

            Control.Layer.InsertSublayer(gradLayer, 0);
        }
Beispiel #3
0
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null) // perform initial setup
            {
                var page          = e.NewElement as GradientContentPage;
                var gradientLayer = new CoreAnimation.CAGradientLayer();
                gradientLayer.Frame  = View.Bounds;
                gradientLayer.Colors = new CoreGraphics.CGColor[] { page.StartColor.ToCGColor(), page.EndColor.ToCGColor() };
                View.Layer.InsertSublayer(gradientLayer, 0);
            }
        }
Beispiel #4
0
        void SetStyles()
        {
            var gradient = new CoreAnimation.CAGradientLayer();

            gradient.Frame  = UIScreen.MainScreen.Bounds;
            gradient.Colors = new CGColor[] { new UIColor(red: 0.04f, green: 0.71f, blue: 0.64f, alpha: 1).CGColor,
                                              new UIColor(red: 0.07f, green: 0.57f, blue: 0.76f, alpha: 1).CGColor };
            gradient.StartPoint        = new CGPoint(0, 0);
            gradient.EndPoint          = new CGPoint(1, 0);
            BackgroundView.Layer.Frame = UIScreen.MainScreen.Bounds;
            BackgroundView.Layer.AddSublayer(gradient);

            UIColor buttonBackgroundColor = new UIColor(white: 0, alpha: 0.6f);

            EnrollButton.BackgroundColor           = buttonBackgroundColor;
            AuthButton.BackgroundColor             = buttonBackgroundColor;
            CheckEnrollmentButton.BackgroundColor  = buttonBackgroundColor;
            DeleteEnrollmentButton.BackgroundColor = buttonBackgroundColor;
        }