public void OnClick(Android.Views.View v) { if (serviceButton.isSelected) { Control.SetBackgroundResource(Android.Graphics.Color.Transparent); Control.SetBackgroundResource(Resource.Drawable.service_unselected_button_style); Control.SetTextColor(Android.Graphics.Color.ParseColor("#BCC1C4")); } else { Control.SetBackgroundResource(Android.Graphics.Color.Transparent); Control.SetBackgroundResource(Resource.Drawable.service_selected_button_style); Control.SetTextColor(Android.Graphics.Color.ParseColor("#FE7890")); } serviceButton.isSelected = !serviceButton.isSelected; serviceButton.serviceName = Control.Text; serviceButton.OnOffServices(serviceButton.isSelected); }
void TouchUpInsideEvent(object sender, EventArgs eventArgs) { if (serviceButton.isSelected) { 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); } else { 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); } serviceButton.isSelected = !serviceButton.isSelected; serviceButton.serviceName = Control.TitleLabel.Text.ToString(); serviceButton.OnOffServices(serviceButton.isSelected); }