$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Buttons Control for WinForms UI Tutorial
State properties of radio button design for Window Forms C# applications
Home > WinForms UI Controls > User Manual > Radio Button State in C#

State Properties of RadioButton - C# WinForms UI Design

The Toggle State property determines the state of Radio Button. The following tutorial shows how to trigger the events to take action while the users of application toggle the radio button.
This Radio Button Control is designed for developers to add robust data binding, 3-state management, including checked, unchecked, and undetermined, and more extended UI design options like image scaling, multi-line text, themes, custom radio shapes, and more. This Radio Button Control for WinForms UI could replace the Windows Forms Standard Radio Button control and bring more user interface styles.

Related Button UI for C# Windows Forms Applications

How to Set Toggle State Changed Events

Developers could use the Toggle State Changed event to trigger the Radio Button to take action while users toggling the button. The event handler will pass a parameter of State Changed Event Args, in which includes a Toggle State member.

void radioButton2_ToggleStateChanged(object sender, StateChangedEventArgs args)
{
MessageBox.Show(args.ToggleState.ToString());
}

How to Change the Toggle State

It is also possible to operate the event of Toggle State Change to cancel the change of the toggle states here. The following are some properties for manipulating the event of Toggle State Change:

Properties Available:

  • StateChangEventArgs will be passed to the event handler via a parameter
  • New Value property, included under the StateChangEventArgs, controls the value of the Toggle State that will be applied when the event is completed
  • Old Value property, included under the StateChangEventArgs, specify the value of Toggle State when the change of the toggle state was initiated
  • Cancel property, a Boolean value and included under the StateChangEventArgs, determines the value of Toggle State is applied when the event being completed. When the value of this property is true, it will prevent the property of Toggle State Changed from initializing and will leave the value of Toggle State as it was.
The following is a sample C# code for manipulating the Toggle State Change event. The C# code will let a Toggle Button to toggle only if the value of a second Toggle Button is set to off. The toggle will be canceled if developers set both the value of the second button toggle state and the value of the New Value as On. The event of Toggle State Changed will only triggers and changes the property of Text when the value of Toggle State Change is not Cancel.

void radioButton3_ToggleStateChanging(object sender, StateChangingEventArgs args)
{
args.Cancel = true;
}

void radioButton3_ToggleStateChanged(object sender, StateChangedEventArgs args)
{
this.radioButton3.Text = args.ToggleState.ToString();
}

UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls