Class CheckedChangeEventArgs<TChecked>
Provides event data for the ValueChange event of checkbox and toggle components
in the Syncfusion Blazor Toolkit.
Inheritance
Namespace: Syncfusion.Blazor.Toolkit.Inputs
Assembly: Syncfusion.Blazor.Toolkit.dll
Syntax
public class CheckedChangeEventArgs<TChecked> : Object
Type Parameters
| Name | Description |
|---|---|
| TChecked | The type of the checked value (typically System.Boolean). |
Remarks
This class contains information about the changed value and the mouse event that triggered the change. It is used by checkbox and switch components to provide context about value changes.
Examples
The following example demonstrates handling a value change event:
<SfCheckBox @bind-Checked="isChecked" ValueChange="@OnValueChanged" />
@code {
private bool isChecked;
private void OnValueChanged(ChangeEventArgs<bool> args)
{
bool newValue = args.Checked;
MouseEventArgs mouseEvent = args.Event;
Console.WriteLine($"Checkbox changed to: {newValue}");
}
}
Constructors
CheckedChangeEventArgs()
Declaration
public CheckedChangeEventArgs()
Properties
Checked
Gets or sets the new checked value after the change occurred.
Declaration
public TChecked Checked { get; set; }
Property Value
| Type | Description |
|---|---|
| TChecked | The checked value of type |
Remarks
This property contains the updated value after the user interaction or programmatic change.
For boolean checkboxes, this is typically true when checked or false when unchecked.
Examples
private void OnValueChanged(ChangeEventArgs<bool> args)
{
bool isNowChecked = args.Checked;
}
Event
Gets or sets the mouse event that triggered the value change.
Declaration
public MouseEventArgs Event { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.AspNetCore.Components.Web.MouseEventArgs | A Microsoft.AspNetCore.Components.Web.MouseEventArgs object containing mouse event details, or |
Remarks
This property provides additional context about the user interaction, including mouse position,
button details, and modifier keys. It is null when the value is changed programmatically
rather than through user interaction.
Examples
private void OnValueChanged(ChangeEventArgs<bool> args)
{
if (args.Event != null)
{
long clickX = args.Event.ClientX;
long clickY = args.Event.ClientY;
}
}