private void CheckedChanged(object sender, EventArgs e) { ToolStripMenuItem Item = (ToolStripMenuItem)sender; if (Item.Checked) { for (int i = 0; i < Items.Length; i++) { if (Item.GetHashCode() != Items[i].GetHashCode()) { Items[i].Checked = false; } else { CheckedChange?.Invoke(this, new EventArgs()); } } } else { bool HaveSelection = false; for (int i = 0; i < Items.Length; i++) { if (Items[i].Checked) { HaveSelection = true; } } if (!HaveSelection) { Item.Checked = true; } } }
protected async Task InputCheckedChange(ChangeEventArgs args) { if (args != null && args.Value is bool value) { // A somewhat kludgy attempt at adding a third state with minimal disruption // in the original behavior. It has the inelegant effect of cycling through // the third (null/indeterminate) state twice in a full cycle, once after each // of the other states (true/false), instead of just once in a sequental series. bool?newValue = value; if ((_lastNullValue == null && Value.HasValue) || (Value.HasValue && Value.Value == _lastNullValue)) { _lastNullValue = !Value.Value; newValue = null; } await base.ChangeValue(newValue); #pragma warning disable CS0618 // Type or member is obsolete if (CheckedChange.HasDelegate) // kept for compatibility reasons with previous versions { await CheckedChange.InvokeAsync(newValue); } #pragma warning restore CS0618 // Type or member is obsolete } }
void OnCheckBoxTapped(object sender, EventArgs args) { IsChecked = !IsChecked; if (!_enModositok) { CheckedChange?.Invoke(this, IsChecked); } //_myIschecked = !_myIschecked; //IsChecked =_myIschecked ; //boxLabel.Text = (bool)_myIschecked ? "⚫" : "⚪"; }
protected virtual void OnCheckedChange(EventArgs e) { if (Checked) { CheckImage.Source = CheckedImage; } else { CheckImage.Source = UnCheckedImage; } CheckedChange?.Invoke(this, e); }
protected async Task InputCheckedChange(ChangeEventArgs args) { if (args != null && args.Value is bool value) { await base.ChangeValue(value); if (CheckedChange.HasDelegate) //kept for compatibility reasons with previous versions { await CheckedChange.InvokeAsync(value); } CheckboxGroup?.OnCheckboxChange(this); } }
protected void Radio_Tapped(object sender, EventArgs e) { if (this.Checked == false) { foreach (View item in ((Layout <View>)RadioTableView.Parent.Parent).Children) { if (item is RadioButton) { RadioButton rb = (RadioButton)item; if (rb.GroupName == this.GroupName && rb != sender) { rb.Checked = false; } } } this.Checked = true; CheckedChange?.Invoke(this, e); } }
/*public bool _myIschecked; * public bool myIschecked * { * get { return _myIschecked; } * set * { * this._myIschecked = value; * boxLabel.Text = (bool)_myIschecked ? "⚫" : "⚪"; * //CheckedChange?.Invoke(this, (bool)_myIschecked); * * //myFrame.BackgroundColor = _myIschecked ? Color.White : Color.Aqua; * //myFrame.CornerRadius = _myIschecked ? 0 : 20; * } * * }*/ private void rb_CheckedChange(object sender, bool e) { //throw new NotImplementedException(); int idx = 0; foreach (var item in listCheckbox) { idx++; if (item.Id == ((RadioButton)sender).Id) { _Value = idx; item.myIschecked = true; } else { item.myIschecked = false; } } CheckedChange?.Invoke(this, (int)Value); //Debug.WriteLine("Nyomi:" + ((RadioButton)sender).Text); }
protected virtual void OnCheckedChange(EventArgs e) { CheckedChange?.Invoke(this, e); }