Ejemplo n.º 1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null)
            {
                _myButton = e.OldElement as SizedButton;
            }
            if (e.NewElement != null)
            {
                _myButton = e.NewElement as SizedButton;
            }
            if (Element != null)
            {
                _myButton = Element as SizedButton;
            }

            if (Control != null)
            {
                _androidButton = Control;
            }
            else
            {
                _androidButton = CreateNativeControl();
                SetNativeControl(_androidButton);
            }

            if (_myButton != null)
            {
                _androidButton.Elevation = _myButton.Elevation;
                if (!_myButton.Capitalize)
                {
                    _androidButton.SetSupportAllCaps(false);
                }
                if (_myButton.BackgroundColor == Color.Transparent)
                {
                    _androidButton.Background = Context.GetDrawable(Resource.Drawable.abc_btn_borderless_material);
                }
            }
        }