alexa
menu

Blazor

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

    Show / Hide Table of Contents

    Class DateRangePickerEvents<TValue>

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

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    DateRangePickerEvents<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 DateRangePickerEvents<TValue> : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    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
    [Parameter]
    public EventCallback<BlurEventArgs> Blur { get; set; }
    Property Value
    Type Description
    EventCallback<BlurEventArgs>

    An EventCallback<TValue> 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
    [Parameter]
    public EventCallback<ClearedEventArgs> Cleared { get; set; }
    Property Value
    Type Description
    EventCallback<ClearedEventArgs>

    An EventCallback<TValue> 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
    [Parameter]
    public EventCallback<object> Created { get; set; }
    Property Value
    Type Description
    EventCallback<object>

    An 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
    [Parameter]
    public EventCallback<object> Destroyed { get; set; }
    Property Value
    Type Description
    EventCallback<object>

    An 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
    [Parameter]
    public EventCallback<FocusEventArgs> Focus { get; set; }
    Property Value
    Type Description
    EventCallback<FocusEventArgs>

    An EventCallback<TValue> 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
    [Parameter]
    public EventCallback<NavigatedEventArgs> Navigated { get; set; }
    Property Value
    Type Description
    EventCallback<NavigatedEventArgs>

    An EventCallback<TValue> 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
    [Parameter]
    public EventCallback<RangePopupEventArgs> OnClose { get; set; }
    Property Value
    Type Description
    EventCallback<RangePopupEventArgs>

    An EventCallback<TValue> 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
    [Parameter]
    public EventCallback<RangePopupEventArgs> OnOpen { get; set; }
    Property Value
    Type Description
    EventCallback<RangePopupEventArgs>

    An EventCallback<TValue> 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
    [Parameter]
    public EventCallback<RenderDayCellEventArgs> OnRenderDayCell { get; set; }
    Property Value
    Type Description
    EventCallback<RenderDayCellEventArgs>

    An EventCallback<TValue> 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
    [Parameter]
    public EventCallback<RangePickerEventArgs<TValue>> RangeSelected { get; set; }
    Property Value
    Type Description
    EventCallback<RangePickerEventArgs<TValue>>

    An EventCallback<TValue> 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
    [Parameter]
    public EventCallback<RangePickerEventArgs<TValue>> ValueChange { get; set; }
    Property Value
    Type Description
    EventCallback<RangePickerEventArgs<TValue>>

    An EventCallback<TValue> 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
    Task

    A Task that represents the asynchronous initialization process.

    Overrides
    ComponentBase.OnInitializedAsync()
    Remarks

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

    Implements

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