Class ItemEventArgs<T>
Provides strongly-typed event arguments for item rendering events in list-based components.
Inheritance
Namespace: Syncfusion.Blazor.Toolkit.Calendars
Assembly: Syncfusion.Blazor.Toolkit.dll
Syntax
public class ItemEventArgs<T> : Object
Type Parameters
| Name | Description |
|---|---|
| T | The type of the item value being rendered (typically System.DateTime for time picker items). |
Remarks
This class contains information about individual list items as they are rendered in dropdown components such as time pickers. It allows customization of item appearance, disabling specific items, and accessing item-specific data during the rendering process. This event is fired for each item in the dropdown list.
Examples
<SfTimePicker TValue="DateTime?" ItemRender="OnItemRender"></SfTimePicker>
@code {
void OnItemRender(ItemEventArgs<DateTime?> args)
{
// Disable lunch hour (12:00 PM)
if (args.Value?.Hour == 12 && args.Value?.Minute == 0)
{
args.IsDisabled = true;
}
}
}
Constructors
ItemEventArgs()
Declaration
public ItemEventArgs()
Properties
IsDisabled
Gets or sets a value indicating whether the current item should be disabled.
Declaration
public bool IsDisabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Remarks
This property allows you to programmatically disable specific items during the rendering process.
When set to true, the item will be displayed as disabled and cannot be selected by users.
This is useful for implementing business rules such as disabling specific time slots or invalid options.
Name
Gets or sets the name of the item rendering event.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | A |
Remarks
This property specifies the name identifier for the item rendering event, which can be used to identify the specific type of rendering event in scenarios where multiple event handlers are used.
Text
Gets or sets the display text for the list item.
Declaration
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | A |
Remarks
This property contains the formatted text that will be displayed to users in the dropdown list. You can modify this property to customize how items appear in the list, such as adding prefixes, suffixes, or applying different formatting rules.
Value
Gets or sets the underlying value object for the list item.
Declaration
public T Value { get; set; }
Property Value
| Type | Description |
|---|---|
| T | A value of type |
Remarks
This property contains the strongly-typed value that corresponds to the list item being rendered. The type is determined by the generic parameter, allowing for flexibility in different component implementations. This value is what gets selected when the user chooses this item from the list.