# Behavior

## Content

The C1DateRangeEdit class provides properties and events to configure date range selection behavior, predefined ranges, and selection constraints.

### Select a Date Range

The control allows selection of a start date and an end date from the drop-down calendar. The selected range is displayed in the editor and highlighted in the calendar.

```auto
// Get selected date range
var range = dateRangeEdit.GetSelectedDateRange();
```

![DateRangeSelection-20260416-122647](https://cdn.mescius.io/document-site-files/images/1b33a1f1-17e3-4593-a233-97e8b8ff7610/DateRangeSelection-20260416-122647-20260513.6f7b49.gif?width=600)

### Use Predefined Ranges

Use predefined ranges to provide quick access to commonly used date intervals.

```auto
// Enable predefined ranges
dateRangeEdit.Calendar.ShowPredefinedRanges = true;
```

![image-20260416-104801](https://cdn.mescius.io/document-site-files/images/1b33a1f1-17e3-4593-a233-97e8b8ff7610/image-20260416-104801-20260513.f0fcf9.png?width=600)

### Set Date Range Constraints

Use the `MinValue` and `MaxValue` properties to restrict selectable dates.
Dates earlier than `MinValue` or later than `MaxValue` cannot be selected.

```auto
// Set minimum date
dateRangeEdit.MinValue = new DateTime(2026, 04, 10);

// Set maximum date
dateRangeEdit.MaxValue = new DateTime(2026, 04, 23);
```

![image-20260416-114803](https://cdn.mescius.io/document-site-files/images/1b33a1f1-17e3-4593-a233-97e8b8ff7610/image-20260416-114803-20260513.ad70cb.png?width=600)

### Limit the Selection Range

Use the `MaxSelectionCount` property to restrict the number of selectable days.

```auto
// Limit number of selectable days
dateRangeEdit.Calendar.MaxSelectionCount = 3;
```

![LimitSelectionRange-20260416-121611](https://cdn.mescius.io/document-site-files/images/1b33a1f1-17e3-4593-a233-97e8b8ff7610/LimitSelectionRange-20260416-121611-20260513.9727ac.gif?width=600)

### Configure Calendar Dimensions

Use the `CalendarDimensions` property to display multiple months simultaneously.

```auto
// Show multiple months
dateRangeEdit.Calendar.CalendarDimensions = 3;
```

![image-20260416-121815](https://cdn.mescius.io/document-site-files/images/1b33a1f1-17e3-4593-a233-97e8b8ff7610/image-20260416-121815-20260513.9dfdcd.png?width=600)

### Handle Events

The control provides events for handling date range interaction.

* `DateRangeSelected` occurs when a date range is selected.
* `DateRangeChanged` occurs when the selected range changes.

```auto
dateRangeEdit.DateRangeSelected += (s, e) =>
{
    // Handle range selected
};

dateRangeEdit.DateRangeChanged += (s, e) =>
{
    // Handle range changed
};
```

 

### Culture-Specific Behavior

DateRangeEdit reflects culture-specific formatting and calendar behavior based on the current application culture.

```auto
// Example: change cultureSystem.Threading.Thread.CurrentThread.CurrentCulture =
    new System.Globalization.CultureInfo("ja-JP");
```

![image-20260416-121914](https://cdn.mescius.io/document-site-files/images/1b33a1f1-17e3-4593-a233-97e8b8ff7610/image-20260416-121914-20260513.1c8032.png?width=600)