Пример #1
0
        protected override void OnStateChanged(BulkEditorAdapter sender, BulkEditorStateEventArgs e)
        {
            base.OnStateChanged(sender, e);
            AutoHeightRadioButton autoHeightRadioButton = base.HostControl as AutoHeightRadioButton;
            bool @checked = autoHeightRadioButton.Checked;

            RadioButtonBulkEditorAdapter.UpdatePeerRadioButtons(autoHeightRadioButton, base["Checked"]);
            if (base["Checked"] != null && base["Checked"] != 3)
            {
                this.forceAllowCheckedChangedEvent = true;
                autoHeightRadioButton.Checked      = autoHeightRadioButton.BulkEditDefaultChecked;
                this.forceAllowCheckedChangedEvent = false;
                autoHeightRadioButton.Checked      = @checked;
                Binding binding = autoHeightRadioButton.DataBindings["Checked"];
                if (binding != null)
                {
                    binding.WriteValue();
                }
                autoHeightRadioButton.TabStop = true;
            }
            else if (base["Checked"] != 3)
            {
                autoHeightRadioButton.Checked = !autoHeightRadioButton.Checked;
            }
            autoHeightRadioButton.Invalidate();
        }
        private void option_CheckedChanged(object sender, EventArgs e)
        {
            AutoHeightRadioButton autoHeightRadioButton = (AutoHeightRadioButton)sender;

            if (autoHeightRadioButton.Checked)
            {
                this.currentOption = autoHeightRadioButton;
                this.MakeDirty();
            }
        }
Пример #3
0
        public static void BindRadioButtonToOptionValue <T>(AutoHeightRadioButton radioButton, T optionValue, object dataSource, string dataMember)
        {
            if (radioButton == null)
            {
                throw new ArgumentNullException("radioButton");
            }
            Binding dataBinding = radioButton.DataBindings.Add("Checked", dataSource, dataMember, true, DataSourceUpdateMode.Never);

            dataBinding.Format += delegate(object sender, ConvertEventArgs e)
            {
                e.Value = (!e.Value.IsNullValue() && optionValue.Equals((T)((object)e.Value)));
            };
            dataBinding.Parse += delegate(object sender, ConvertEventArgs e)
            {
                e.Value = optionValue;
                dataBinding.DataSourceUpdateMode = DataSourceUpdateMode.Never;
            };
            radioButton.CheckedChangedRaising += delegate(object sender, HandledEventArgs e)
            {
                dataBinding.DataSourceUpdateMode = (radioButton.Checked ? DataSourceUpdateMode.OnPropertyChanged : DataSourceUpdateMode.Never);
            };
        }
Пример #4
0
 public RadioButtonBulkEditorAdapter(AutoHeightRadioButton radioButton) : base(radioButton)
 {
     this.bulkEditSupport.Entering += this.OnEntering;
 }
 private int RadioButtonIndex(AutoHeightRadioButton ro)
 {
     return(Array.IndexOf <AutoHeightRadioButton>(this.allOptionRadioButtons, ro));
 }