protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                scopeButton = (ScopeButton)e.NewElement;
                if (scopeButton.isSelected)
                {
                    Control.SetBackgroundResource(Resource.Drawable.service_selected_button_style);
                    Control.SetTextColor(Android.Graphics.Color.ParseColor("#FE7890"));
                }
                else
                {
                    Control.SetBackgroundResource(Resource.Drawable.service_unselected_button_style);
                    Control.SetTextColor(Android.Graphics.Color.ParseColor("#BCC1C4"));
                }

                Control.TextAlignment = Android.Views.TextAlignment.Center;
                Control.Gravity       = GravityFlags.Center;
                Control.SetIncludeFontPadding(false);
                Control.InputType = Android.Text.InputTypes.TextFlagCapSentences;
                Control.Activated = false;
                Control.SetOnClickListener(this);
            }
        }
Exemplo n.º 2
0
        protected override void OnClick(EventArgs e)
        {
            if (!state)
            {
                SetPassiveStyle();
                ScopeButton.Show();
                state = true;
            }
            else
            {
                SetActiveStyle();
                ScopeButton.Hide();
                state = false;
            }

            ParentPanelToolBox.RePaint();

            base.OnClick(e);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                scopeButton = (ScopeButton)e.NewElement;
                if (scopeButton.isSelected)
                {
                    Control.Layer.CornerRadius = 2.0f;
                    Control.BackgroundColor    = UIColor.White;
                    Control.Layer.BorderWidth  = 1.0f;
                    Control.Layer.BorderColor  = UIColor.FromRGB(254, 120, 144).CGColor;
                    Control.SetTitleColor(UIColor.FromRGB(254, 120, 144), UIControlState.Normal);
                }
                else
                {
                    Control.TitleEdgeInsets = new UIEdgeInsets(0, 5, 0, 5);

                    Control.Layer.CornerRadius = 2.0f;
                    Control.BackgroundColor    = UIColor.White;
                    Control.Layer.BorderWidth  = 1.0f;
                    Control.Layer.BorderColor  = UIColor.FromRGB(188, 193, 196).CGColor;
                    Control.SetTitleColor(UIColor.FromRGB(188, 193, 196), UIControlState.Normal);
                }

                //CGRect frame = Control.Frame;
                //frame.Width = frame.re + 50;
                Control.SizeToFit();


                Control.Bounds              = new CGRect(Control.Bounds.X, Control.Bounds.Y, Control.Bounds.Width, Control.Bounds.Height);
                Control.VerticalAlignment   = UIControlContentVerticalAlignment.Center;
                Control.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;

                Control.Selected = false;

                Control.TouchUpInside += TouchUpInsideEvent;
            }
        }