Beispiel #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Frame> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                myFrame = (e.NewElement as AdvancedFrame);

                int topLeft     = myFrame.Corners == RoundedCorners.left || myFrame.Corners == RoundedCorners.all ? myFrame.CornerRadius : 0;
                int topRight    = myFrame.Corners == RoundedCorners.right || myFrame.Corners == RoundedCorners.all ? myFrame.CornerRadius : 0;
                int bottomRight = myFrame.Corners == RoundedCorners.right || myFrame.Corners == RoundedCorners.all ? myFrame.CornerRadius : 0;
                int bottomLeft  = myFrame.Corners == RoundedCorners.left || myFrame.Corners == RoundedCorners.all ? myFrame.CornerRadius : 0;

                this.Control.CornerRadius = new CornerRadius(topLeft, topRight, bottomRight, bottomLeft);

                if (myFrame.InnerBackground != null)
                {
                    this.Control.Background = new SolidColorBrush(
                        Windows.UI.Color.FromArgb(
                            (byte)Math.Round(myFrame.InnerBackground.A * 255),
                            (byte)Math.Round(myFrame.InnerBackground.R * 255),
                            (byte)Math.Round(myFrame.InnerBackground.G * 255),
                            (byte)Math.Round(myFrame.InnerBackground.B * 255)
                            ));
                }
            }
        }
Beispiel #2
0
 public FrameDrawable(AdvancedFrame frame, Func <double, float> convertToPixels)
 {
     _frame                 = frame;
     _convertToPixels       = convertToPixels;
     frame.PropertyChanged += FrameOnPropertyChanged;
 }