コード例 #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                return;
            }

            if (e?.OldElement != null)
            {
                _helper.Clean();
            }

            if (e?.NewElement == null)
            {
                return;
            }

            _materialButton = (MaterialButton)Element;
            _helper         = new MaterialDrawableHelper(_materialButton, Control);
            _helper.UpdateDrawable();

            Control.SetMinimumWidth((int)MaterialHelper.ConvertDpToPx(64));
            Control.SetAllCaps(_materialButton != null && _materialButton.AllCaps);
            Control.SetMaxLines(1);

            SetTextColors();
        }
コード例 #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (this.Control == null)
            {
                return;
            }

            if (e?.OldElement != null)
            {
                _helper.Clean();
            }

            if (e?.NewElement == null)
            {
                return;
            }
            _materialButton = this.Element as MaterialButton;
            _helper         = new MaterialDrawableHelper(_materialButton, this.Control);
            _helper.UpdateDrawable();

            this.Control.SetMinimumWidth((int)MaterialHelper.ConvertToDp(64));
            this.Control.SetAllCaps(_materialButton != null && _materialButton.AllCaps);

            this.SetButtonIcon();
            this.SetTextColors();
            this.SetTextLetterSpacing();
        }