Class ChangeEventArgs<T>
Provides strongly-typed event arguments for change events in calendar and time picker components.
Inheritance
Namespace: Syncfusion.Blazor.Calendars
Assembly: Syncfusion.Blazor.dll
Syntax
public class ChangeEventArgs<T> : Object
Type Parameters
Name | Description |
---|---|
T | The type of the component's value (typically System.DateTime or nullable System.DateTime). |
Remarks
This generic class provides comprehensive information about value changes in date/time picker components. It includes the new value, formatted text representation, interaction details, and references to the original browser event and DOM element. This allows for detailed handling of value change scenarios.
Examples
<SfTimePicker TValue="DateTime?">
<TimePickerEvents TValue="DateTime?" ValueChange="OnTimeChanged"></TimePickerEvents>
</SfTimePicker>
@code {
void OnTimeChanged(ChangeEventArgs<DateTime?> args)
{
if (args.IsInteracted && args.Value.HasValue)
{
Console.WriteLine($"User selected time: {args.Value}");
Console.WriteLine($"Formatted text: {args.Text}");
}
}
}
Constructors
ChangeEventArgs()
Declaration
public ChangeEventArgs()
Properties
Element
Gets or sets the DOM element associated with the change event.
Declaration
public object Element { get; set; }
Property Value
Type | Description |
---|---|
System.Object | An |
Remarks
This property provides access to the DOM element that was involved in the value change event, allowing for additional manipulation, styling, or inspection of the element during event handling.
Event
Gets or sets the original browser event that triggered the value change.
Declaration
public object Event { get; set; }
Property Value
Type | Description |
---|---|
System.Object | An |
Remarks
This property contains the raw browser event information, such as input events, click events, or keyboard events, that caused the component's value to change. It provides access to the underlying event details for advanced event handling scenarios.
IsInteracted
Gets or sets a value indicating whether the change was triggered by user interaction.
Declaration
public bool IsInteracted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property helps distinguish between programmatic value changes and user-initiated changes.
When true
, the value change was caused by user actions such as typing, clicking, or keyboard navigation.
When false
, the value change was likely caused by programmatic updates to the component's value.
Text
Gets or sets the formatted text representation of the selected value.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | A |
Remarks
This property contains the human-readable string representation of the selected date/time value, formatted according to the component's format settings and culture-specific formatting rules. This is the text that appears in the component's input field.
Value
Gets or sets the selected date/time value.
Declaration
public T Value { get; set; }
Property Value
Type | Description |
---|---|
T | A value of type |
Remarks
This property contains the strongly-typed date/time value that was selected or changed in the component. The type is determined by the generic parameter, allowing for flexibility in different date/time picker implementations.