コード例 #1
0
ファイル: SubClass.cs プロジェクト: meguerreroa/VNXTLP
            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;
                    }
                }
            }
コード例 #2
0
    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
        }
    }
コード例 #3
0
 void OnCheckBoxTapped(object sender, EventArgs args)
 {
     IsChecked = !IsChecked;
     if (!_enModositok)
     {
         CheckedChange?.Invoke(this, IsChecked);
     }
     //_myIschecked = !_myIschecked;
     //IsChecked =_myIschecked  ;
     //boxLabel.Text = (bool)_myIschecked ? "⚫" : "⚪";
 }
コード例 #4
0
 protected virtual void OnCheckedChange(EventArgs e)
 {
     if (Checked)
     {
         CheckImage.Source = CheckedImage;
     }
     else
     {
         CheckImage.Source = UnCheckedImage;
     }
     CheckedChange?.Invoke(this, e);
 }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
 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);
     }
 }
コード例 #7
0
        /*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);
        }
コード例 #8
0
 protected virtual void OnCheckedChange(EventArgs e)
 {
     CheckedChange?.Invoke(this, e);
 }