What are the events available in ToggleButton in Windows Forms Toggle Button

The following listed events are available in Toggle Button.

  • ToggleStateChanging
  • ToggleStateChanged

ToggleStateChanging

This event is triggered in Toggle Button when its state is changing.

Event data

Member Table

Member Description
Cancel Gets or sets the value indicating whether the state change should be canceled or not.
void toggleButton1_ToggleStateChanging(object sender, CancelEventArgs e)
{
    Console.WriteLine("ToggleStateChanging event raised!");
}
Private Sub toggleButton1_ToggleStateChanging(ByVal sender As Object, ByVal e As CancelEventArgs)
Console.WriteLine("ToggleStateChanging event raised!")
End Sub

ToggleStateChanged

This event is triggered in Toggle Button after its value is changed. 

Event data

Member Table

Member Description
ToggleState Returns the current state of the ToggleButton.
void toggleButton1_ToggleStateChanged(object sender, Syncfusion.Windows.Forms.Tools.ToggleStateChangedEventArgs e)
{
    ToggleButtonState state = e.ToggleState;
    Console.WriteLine("ToggleStateChanged event is raised");
}
Private Sub toggleButton1_ToggleStateChanged(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.ToggleStateChangedEventArgs)
Dim state As ToggleButtonState = e.ToggleState
Console.WriteLine("ToggleStateChanged event is raised")
End Sub