Skip to main content

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);
    }
}