menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DateRangePickerEvents<TValue> - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DateRangePickerEvents<TValue>

    Defines the event callbacks for the SfDateRangePicker<TValue> component.

    Inheritance
    System.Object
    DateRangePickerEvents<TValue>
    Namespace: Syncfusion.Blazor.Calendars
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DateRangePickerEvents<TValue> : OwningComponentBase
    Type Parameters
    Name Description
    TValue

    The data type of the selected date range.

    Remarks

    This class allows you to handle various events triggered by the SfDateRangePicker<TValue>, such as value changes, popup opening/closing, and cell rendering.

    Constructors

    DateRangePickerEvents()

    Declaration
    public DateRangePickerEvents()

    Properties

    Blur

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

    Declaration
    public EventCallback<BlurEventArgs> Blur { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<BlurEventArgs>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the component loses focus.

    Remarks

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

    Cleared

    Gets or sets an event callback that is raised when the selected date range is cleared using the clear button.

    Declaration
    public EventCallback<ClearedEventArgs> Cleared { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<ClearedEventArgs>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the date range is cleared.

    Remarks

    This event allows you to handle the scenario where the user explicitly clears the selected date range.

    Created

    Gets or sets an event callback that is raised after the component has been created.

    Declaration
    public EventCallback<object> Created { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<System.Object>

    An Microsoft.AspNetCore.Components.EventCallback that is invoked when the component is created.

    Remarks

    This event is useful for performing initialization tasks after the component has been rendered for the first time.

    Destroyed

    Gets or sets an event callback that is raised before the component is destroyed.

    Declaration
    public EventCallback<object> Destroyed { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<System.Object>

    An Microsoft.AspNetCore.Components.EventCallback that is invoked when the component is about to be destroyed.

    Remarks

    This event allows you to perform cleanup tasks before the component is removed from the DOM.

    Focus

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

    Declaration
    public EventCallback<FocusEventArgs> Focus { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<FocusEventArgs>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the component gains focus.

    Remarks

    This event can be used to perform actions when the user focuses on the DateRangePicker component, such as highlighting it or displaying related information.

    Navigated

    Gets or sets an event callback that is raised when the calendar view is navigated.

    Declaration
    public EventCallback<NavigatedEventArgs> Navigated { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<NavigatedEventArgs>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the calendar view changes (e.g., month, year). The callback receives a NavigatedEventArgs.

    Remarks

    This event is triggered when the user navigates to a different month or year within the calendar popup.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerEvents TValue="DateTime?" Navigated="@ViewNavigated" />
    </SfDateRangePicker>
    @code{
       private void ViewNavigated(NavigatedEventArgs args) {
           Console.WriteLine("Navigated to: " + args.View);
        }
    }

    OnClose

    Gets or sets an event callback that is raised when the calendar popup is closed.

    Declaration
    public EventCallback<RangePopupEventArgs> OnClose { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<RangePopupEventArgs>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the popup closes. The callback receives a RangePopupEventArgs.

    Remarks

    This event can be used to perform actions after the calendar popup is dismissed. You can also prevent the popup from closing by setting Cancel to true.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerEvents TValue="DateTime?" OnClose="@PopupClose" />
    </SfDateRangePicker>
    @code{
       private void PopupClose(RangePopupEventArgs args) {
           Console.WriteLine("Popup is closing.");
           // To prevent the popup from closing
           // args.Cancel = true;
        }
    }

    OnOpen

    Gets or sets an event callback that is raised when the calendar popup is opened.

    Declaration
    public EventCallback<RangePopupEventArgs> OnOpen { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<RangePopupEventArgs>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the popup opens. The callback receives a RangePopupEventArgs.

    Remarks

    This event can be used to perform actions before the calendar popup is displayed. You can also prevent the popup from opening by setting Cancel to true.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerEvents TValue="DateTime?" OnOpen="@PopupOpen" />
    </SfDateRangePicker>
    @code{
       private void PopupOpen(RangePopupEventArgs args) {
           Console.WriteLine("Popup is opening.");
           // To prevent the popup from opening
           // args.Cancel = true;
        }
    }

    OnRenderDayCell

    Gets or sets an event callback that is raised when each day cell of the calendar is rendered.

    Declaration
    public EventCallback<RenderDayCellEventArgs> OnRenderDayCell { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<RenderDayCellEventArgs>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked for each day cell. The callback receives a RenderDayCellEventArgs.

    Remarks

    This event allows for customization of individual day cells, such as adding custom styles or disabling specific dates.

    Examples
    <SfDateRangePicker TValue="DateTime?">
       <DateRangePickerEvents TValue="DateTime?" OnRenderDayCell="@CellRendered" />
    </SfDateRangePicker>
    @code{
       private void CellRendered(RenderDayCellEventArgs args) {
           if (args.Date.DayOfWeek == DayOfWeek.Saturday || args.Date.DayOfWeek == DayOfWeek.Sunday)
           {
               args.IsDisabled = true;
           }
        }
    }

    RangeSelected

    Gets or sets an event callback that is raised after a start and end date have been selected from the component.

    Declaration
    public EventCallback<RangePickerEventArgs<TValue>> RangeSelected { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<RangePickerEventArgs<TValue>>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked after a date range is selected. The callback receives a RangePickerEventArgs<TValue>.

    Remarks

    This event provides the selected date range, which can be used to perform actions based on the user's selection.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerEvents TValue="DateTime?" RangeSelected="@RangeSelected" />
    </SfDateRangePicker>
    @code{
       private void RangeSelected(RangePickerEventArgs<DateTime?> args) {
           Console.WriteLine("The selected range is: " + args.StartDate + " - " + args.EndDate);
        }
    }

    ValueChange

    Gets or sets an event callback that is raised when the selected date range is changed.

    Declaration
    public EventCallback<RangePickerEventArgs<TValue>> ValueChange { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<RangePickerEventArgs<TValue>>

    An Microsoft.AspNetCore.Components.EventCallback<> that is invoked when the date range changes. The callback receives a RangePickerEventArgs<TValue>.

    Remarks

    This event is triggered whenever the user selects a new date range, providing the new StartDate and EndDate.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerEvents TValue="DateTime?" ValueChange="@ValueChanged" />
    </SfDateRangePicker>
    @code{
       private void ValueChanged(RangePickerEventArgs<DateTime?> args) {
           Console.WriteLine("The selected range is: " + args.StartDate + " - " + args.EndDate);
        }
    }

    Methods

    OnInitializedAsync()

    Method invoked when the component is initialized.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task that represents the asynchronous initialization process.

    Remarks

    This method assigns the current instance of DateRangePickerEvents<TValue> to the parent SfDateRangePicker<TValue> component.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved