Class RangePopupEventArgs
Provides event arguments for DateRangePicker popup events including open and close operations.
Inheritance
Namespace: Syncfusion.Blazor.Calendars
Assembly: Syncfusion.Blazor.dll
Syntax
public class RangePopupEventArgs : Object
Remarks
This class contains information about popup state changes in date range picker components. It provides control over popup behavior, including the ability to cancel the action, specify where the popup should be appended, and access the current date range value.
Examples
<SfDateRangePicker TValue="DateTime?">
<DateRangePickerEvents TValue="DateTime?" OnOpen="OnPopupOpen" OnClose="OnPopupClose"></DateRangePickerEvents>
</SfDateRangePicker>
@code {
void OnPopupOpen(RangePopupEventArgs args)
{
// Append popup to a specific container
args.AppendTo = "#custom-container";
}
void OnPopupClose(RangePopupEventArgs args)
{
// Optionally cancel the popup closing
// args.Cancel = true;
Console.WriteLine($"Current range: {args.Date}");
}
}
Constructors
RangePopupEventArgs()
Declaration
public RangePopupEventArgs()
Properties
AppendTo
Gets or sets the target element where the popup will be appended.
Declaration
public string AppendTo { get; set; }
Property Value
Type | Description |
---|---|
System.String | A |
Remarks
This property accepts CSS selectors to specify where the popup should be rendered in the DOM. Use "#" for element IDs and "." for CSS classes. If not specified, the popup will be appended to the body element or the modal element if one is provided. This is useful for controlling the popup's position and z-index context within complex layouts.
Examples
<SfDateRangePicker TValue="DateTime?">
<DateRangePickerEvents TValue="DateTime?" OnOpen="PopupOpen"></DateRangePickerEvents>
</SfDateRangePicker>
<div id="target" class="popup-container"></div>
@code {
void PopupOpen(RangePopupEventArgs args)
{
args.AppendTo = "#target"; // Append to specific element
// args.AppendTo = ".popup-container"; // Or append to element with class
}
}
Cancel
Gets or sets a value indicating whether the popup action should be canceled.
Declaration
public bool Cancel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property allows you to prevent the popup from opening or closing by setting it to true
.
This is useful for implementing conditional popup behavior based on application state, validation rules,
or user permissions. When canceled, the popup action will be prevented and the popup state will remain unchanged.
Date
Gets or sets the formatted date range string as displayed in the input element.
Declaration
public string Date { get; set; }
Property Value
Type | Description |
---|---|
System.String | A |
Remarks
This property contains the human-readable string representation of the current date range selection, formatted according to the component's format settings and culture. It represents the text that is currently displayed in the date range picker's input field.
Event
Gets or sets the original browser event that triggered the popup action.
Declaration
public object Event { get; set; }
Property Value
Type | Description |
---|---|
System.Object | An |
Remarks
This property contains the raw browser event information that caused the popup to open or close. It provides access to the underlying event details, such as click events or keyboard interactions, for advanced event handling scenarios.