menu

Blazor

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

    Show / Hide Table of Contents

    Class RangePickerEventArgs<TValue>

    Provides strongly-typed event arguments for the RangeSelected event when a date range is selected.

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

    The type of the date values in the range (typically System.DateTime or nullable System.DateTime).

    Remarks

    This generic class provides type-safe event arguments for date range selection events, allowing the start and end dates to be strongly typed according to the component's value type. It contains comprehensive information about the selected date range, including the span between dates and user interaction details.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerEvents TValue="DateTime?" RangeSelected="OnRangeSelected"></DateRangePickerEvents>
    </SfDateRangePicker>
    
    @code {
        void OnRangeSelected(RangePickerEventArgs<DateTime?> args)
        {
            if (args.StartDate.HasValue && args.EndDate.HasValue)
            {
                Console.WriteLine($"Selected range: {args.StartDate} to {args.EndDate}");
                Console.WriteLine($"Duration: {args.DaySpan} days");
            }
        }
    }

    Constructors

    RangePickerEventArgs()

    Declaration
    public RangePickerEventArgs()

    Properties

    DaySpan

    Gets or sets the number of days between the start and end dates of the selected range.

    Declaration
    public double DaySpan { get; set; }
    Property Value
    Type Description
    System.Double

    A double value representing the number of days in the selected date range.

    Remarks

    This property calculates the span between the start and end dates, providing the total number of days included in the selected range. This is useful for validating range constraints, calculating duration, and displaying range information to users.

    Element

    Gets or sets the DOM element associated with the range selection event.

    Declaration
    public object Element { get; set; }
    Property Value
    Type Description
    System.Object

    An object representing the DOM element involved in the range selection. The default value is null.

    Remarks

    This property provides access to the DOM element that was involved in the range selection event, allowing for additional manipulation or inspection of the element if needed during event handling.

    EndDate

    Gets or sets the end date value of the selected range.

    Declaration
    public TValue EndDate { get; set; }
    Property Value
    Type Description
    TValue

    A value of type TValue representing the end date of the selected range. The default value is default(TValue).

    Remarks

    This property contains the last date in the selected date range with strong typing based on the component's value type. Together with StartDate, it defines the complete date range selection.

    Event

    Gets or sets the original browser event that triggered the range selection.

    Declaration
    public object Event { get; set; }
    Property Value
    Type Description
    System.Object

    An object containing the original event arguments from the browser. The default value is null.

    Remarks

    This property contains the raw browser event information that caused the date range selection. It provides access to the underlying event details for advanced event handling scenarios.

    IsInteracted

    Gets or sets a value indicating whether the range selection was triggered by user interaction.

    Declaration
    public bool IsInteracted { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the range selection was triggered by user interaction; otherwise, false.

    Remarks

    This property helps distinguish between programmatic range selections and user-initiated selections. When true, the range selection was caused by user actions like clicking on dates. When false, the range selection was likely caused by programmatic updates to the component's value.

    Name

    Gets or sets the name of the range selection event.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String

    A string value representing the event name. The default value is null.

    Remarks

    This property specifies the name identifier for the range selection event, which can be used to identify the specific type of range selection event in scenarios where multiple event types are handled.

    StartDate

    Gets or sets the start date value of the selected range.

    Declaration
    public TValue StartDate { get; set; }
    Property Value
    Type Description
    TValue

    A value of type TValue representing the start date of the selected range. The default value is default(TValue).

    Remarks

    This property contains the first date in the selected date range with strong typing based on the component's value type. Together with EndDate, it defines the complete date range selection.

    Text

    Gets or sets the formatted text representation of the selected date range.

    Declaration
    public string Text { get; set; }
    Property Value
    Type Description
    System.String

    A string value containing the formatted date range text as displayed in the input element. The default value is null.

    Remarks

    This property contains the human-readable string representation of the selected date range, typically formatted according to the component's format settings and culture-specific formatting rules.

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