コード例 #1
0
        protected override void OnDetached()
        {
            //restore the old color
            SwitchCompat switchCompat = (SwitchCompat)Control;

            switchCompat.SetHighlightColor(oldColor);
        }
コード例 #2
0
        protected override void OnAttached()
        {
            //Store the old color and set the new one
            SwitchCompat      switchCompat = (SwitchCompat)Control;
            SwitchColorEffect effect       = (SwitchColorEffect)Element.Effects.FirstOrDefault(e => e is SwitchColorEffect);

            oldColor = switchCompat.HighlightColor;
            switchCompat.SetHighlightColor(effect.Color.ToAndroid());
        }
コード例 #3
0
        public override View GetView(Context context)
        {
            var cell  = LayoutInflater.From(context).Inflate(Resource.Layout.forms_cell_checkbox, null);
            var label = cell.FindViewById <TextView>(Resource.Id.label);

            _checkBox = cell.FindViewById <SwitchCompat>(Resource.Id.checkbox);
            _checkBox.SetTextColor(AppearanceTextColor);
            _checkBox.SetHighlightColor(AppearanceAccentColor);
            label.Text               = _hint;
            _checkBox.Checked        = _value;
            _checkBox.Enabled        = Form.EditingEnabled;
            _checkBox.CheckedChange += OnCheckBoxClicked;

            return(cell);
        }