alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class TimePickerEvents<TValue>

    Configures the event handlers for the SfTimePicker<TValue> component, allowing you to respond to various user interactions and component lifecycle events.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    TimePickerEvents<TValue>
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnAfterRenderAsync(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.Dispose(bool)
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    Namespace: Syncfusion.Blazor.Calendars
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class TimePickerEvents<TValue> : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    Type Parameters
    Name Description
    TValue

    Specifies the data type of the value bound to the TimePicker.

    Remarks

    The TimePickerEvents component is used within a SfTimePicker<TValue> to define callback methods for events such as value changes, focus, blur, and popup interactions.

    Constructors

    TimePickerEvents()

    Declaration
    public TimePickerEvents()

    Properties

    Blur

    Gets or sets an event callback that is triggered when the component loses focus.

    Declaration
    [Parameter]
    public EventCallback<BlurEventArgs> Blur { get; set; }
    Property Value
    Type Description
    EventCallback<BlurEventArgs>

    An EventCallback<TValue> that is invoked when the component loses focus. The callback receives a BlurEventArgs.

    Remarks

    This event can be used to perform actions when the user navigates away from the TimePicker component.

    Examples
    <SfTimePicker TValue="DateTime?">
    <TimePickerEvents TValue = "DateTime?" Blur="@OnBlur" />
    </SfTimePicker>
    @code{
    private void OnBlur(BlurEventArgs args)
    {
    // Your logic here
    }
    }

    Cleared

    Gets or sets an event callback that is triggered when the component's value is cleared using the clear button.

    Declaration
    [Parameter]
    public EventCallback<ClearedEventArgs> Cleared { get; set; }
    Property Value
    Type Description
    EventCallback<ClearedEventArgs>

    An EventCallback<TValue> that is invoked when the clear button is clicked. The callback receives a ClearedEventArgs.

    Remarks

    This event is only applicable if the ShowClearButton property is set to true.

    Examples
    <SfTimePicker TValue="DateTime?" ShowClearButton="true">
    <TimePickerEvents TValue = "DateTime?" Cleared="@OnCleared" />
    </SfTimePicker>
    @code{
    private void OnCleared(ClearedEventArgs args)
    {
    // Your logic here
    }
    }

    Created

    Gets or sets an event callback that is triggered when the component is created.

    Declaration
    [Parameter]
    public EventCallback<object> Created { get; set; }
    Property Value
    Type Description
    EventCallback<object>

    An EventCallback<TValue> that is invoked when the component is first rendered.

    Remarks

    This event is useful for performing one-time initialization actions after the component has been rendered.

    Examples
    <SfTimePicker TValue="DateTime?">
        <TimePickerEvents TValue="DateTime?" Created="@OnCreated" />
    </SfTimePicker>
    @code {
        private void OnCreated(object args)
        {
            // Your logic here
        }
    }

    Destroyed

    Gets or sets an event callback that is triggered when the component is destroyed.

    Declaration
    [Parameter]
    public EventCallback<object> Destroyed { get; set; }
    Property Value
    Type Description
    EventCallback<object>

    An EventCallback<TValue> that is invoked when the component is being removed from the DOM.

    Remarks

    This event is useful for performing cleanup operations before the component is completely removed.

    Examples
    <SfTimePicker TValue="DateTime?">
    <TimePickerEvents TValue = "DateTime?" Destroyed="@OnDestroyed" />
    </SfTimePicker>
    @code{
    private void OnDestroyed(object args)
    {
    // Your logic here
    }
    }

    Focus

    Gets or sets an event callback that is triggered when the component gains focus.

    Declaration
    [Parameter]
    public EventCallback<FocusEventArgs> Focus { get; set; }
    Property Value
    Type Description
    EventCallback<FocusEventArgs>

    An EventCallback<TValue> that is invoked when the component receives focus. The callback receives a FocusEventArgs.

    Remarks

    This event is useful for performing actions when the user starts interacting with the TimePicker.

    Examples
    <SfTimePicker TValue="DateTime?">
    <TimePickerEvents TValue = "DateTime?" Focus="@OnFocus" />
    </SfTimePicker>
    @code{
    private void OnFocus(FocusEventArgs args)
    {
    // Your logic here
    }
    }

    OnClose

    Gets or sets an event callback that is triggered when the time suggestion popup is closed.

    Declaration
    [Parameter]
    public EventCallback<PopupEventArgs> OnClose { get; set; }
    Property Value
    Type Description
    EventCallback<PopupEventArgs>

    An EventCallback<TValue> that is invoked when the popup closes. The callback receives a PopupEventArgs.

    Remarks

    You can prevent the popup from closing by setting the Cancel property to true within the event handler.

    Examples
    <SfTimePicker TValue="DateTime?">
        <TimePickerEvents TValue="DateTime?" OnClose="@PopupClose" />
    </SfTimePicker>
    @code{
       private void PopupClose(PopupEventArgs args) {
           args.Cancel = true;
        }
      }

    OnItemRender

    Gets or sets an event callback that is triggered while rendering each item in the time suggestion popup.

    Declaration
    [Parameter]
    public EventCallback<ItemEventArgs<TValue>> OnItemRender { get; set; }
    Property Value
    Type Description
    EventCallback<ItemEventArgs<TValue>>

    An EventCallback<TValue> that is invoked for each list item. The callback receives an ItemEventArgs<T>.

    Remarks

    This event allows for the customization of each time item, such as adding custom attributes or disabling specific times.

    Examples
    <SfTimePicker TValue="DateTime?">
        <TimePickerEvents TValue="DateTime?" OnItemRender="@ItemRender" />
    </SfTimePicker>
    @code{
       private void ItemRender(ItemEventArgs<DateTime?> args) {
           Console.WriteLine(args.Text);
        }
      }

    OnOpen

    Gets or sets an event callback that is triggered when the time suggestion popup is opened.

    Declaration
    [Parameter]
    public EventCallback<PopupEventArgs> OnOpen { get; set; }
    Property Value
    Type Description
    EventCallback<PopupEventArgs>

    An EventCallback<TValue> that is invoked when the popup opens. The callback receives a PopupEventArgs.

    Remarks

    You can prevent the popup from opening by setting the Cancel property to true within the event handler.

    Examples
    <SfTimePicker TValue="DateTime?">
        <TimePickerEvents TValue="DateTime?" OnOpen="@PopupOpen" />
    </SfTimePicker>
    @code{
       private void PopupOpen(PopupEventArgs args) {
           args.Cancel = true;
        }
      }

    Selected

    Gets or sets an event callback that is triggered after a time value is selected from the popup.

    Declaration
    [Parameter]
    public EventCallback<SelectedEventArgs<TValue>> Selected { get; set; }
    Property Value
    Type Description
    EventCallback<SelectedEventArgs<TValue>>

    An EventCallback<TValue> that is invoked when a value is selected. The callback receives a SelectedEventArgs<T>.

    Remarks

    This event provides the selected time value and can be used to perform actions immediately after a selection is made.

    Examples
    <SfTimePicker TValue="DateTime?">
        <TimePickerEvents TValue="DateTime?" Selected="@ValueSelected" />
    </SfTimePicker>
    @code{
       private void ValueSelected(SelectedEventArgs<DateTime?> args) {
            Console.WriteLine(args.Value);
        }
      }

    ValueChange

    Gets or sets an event callback that is triggered when the value of the component is changed.

    Declaration
    [Parameter]
    public EventCallback<ChangeEventArgs<TValue>> ValueChange { get; set; }
    Property Value
    Type Description
    EventCallback<ChangeEventArgs<TValue>>

    An EventCallback<TValue> that is invoked when the component's value changes. The callback receives a ChangeEventArgs<T>.

    Remarks

    This event is fired when the user selects a time from the popup, or when the value is changed programmatically.

    Examples
    <SfTimePicker TValue="DateTime?">
        <TimePickerEvents TValue="DateTime?" ValueChange="@ValueChange" />
    </SfTimePicker>
    @code{
       private void ValueChange(ChangeEventArgs<DateTime?> args) {
            Console.WriteLine(args.Value);
        }
      }

    Methods

    ComponentDispose(bool)

    Disposes the component and cleans up its resources.

    Declaration
    protected void ComponentDispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    A boolean value indicating whether the component is being disposed.

    Remarks

    This protected method is called to release managed resources and disconnect from the parent component.

    OnInitializedAsync()

    Initializes the component and establishes a connection with the parent SfTimePicker<TValue> component.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    Task

    A Task that represents the asynchronous initialization process.

    Overrides
    ComponentBase.OnInitializedAsync()
    Remarks

    This method is part of the Blazor component lifecycle and is called when the component is first initialized.

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved