Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Extend the DateNavigator Selection by Days, not by Weeks

This example illustrates how you can modify the behavior of the Date Navigator control by creating a class descendant and overriding the required properties. The DateNavigator descendant allows selecting more than seven dates by days, not by weeks, which is the default behavior.

public class MyDateNavigator : DateNavigator
{
    protected override DateTime AdjustSelectionEnd(DateTime start, DateTime end)
    {
        return end;
        //return base.AdjustSelectionEnd(start, end);
    }

    protected override DateTime AdjustSelectionStart(DateTime start, DateTime end)
    {
        return start;
        //return base.AdjustSelectionStart(start, end);
    }
}