I need to disable the radbutton just before the click event is fired, and finally resume its enabled state after the click event.
I tried to create a property like this in my CustomRadButton:
But in debug I found out that the base.OnClick(e); event is asynchronous.
Can you suggest something to solve my problem?
Thanks
I tried to create a property like this in my CustomRadButton:
/// <summary> /// On click event /// </summary> /// <param name="e"></param> protected override void OnClick(EventArgs e) { if (this.multiClickAccepted) base.OnClick(e); else { //if the multiclick is disabled (as default) disable the button before raise any event this.temporaryEnabled = this.Enabled; base.Enabled = false; base.OnClick(e); base.Enabled = (bool)this.temporaryEnabled; this.temporaryEnabled = null; //after the reactivation look for any binding to restore the correct button state if (this.DataBindings != null) { foreach (System.Windows.Forms.Binding b in this.DataBindings) { if (b.PropertyName.Equals("Enabled")) b.ReadValue(); } } } }But in debug I found out that the base.OnClick(e); event is asynchronous.
Can you suggest something to solve my problem?
Thanks
