Telerik UI for Windows Phone by Progress

RadDatePicker allows for defining custom intervals for the values in the different date component selectors. For instance, a step of 5 days can be defined so that the days selector will display values with intervals of 5 days only. RadDatePicker also exposes the DayStepBehavior, MonthStepBehavior and YearStepBehavior properties which can be used to fine-tune the behavior of the control when a non-default time step value is defined.

Defining custom Step for RadDatePicker

To define a custom step for the selectable values in a date component selector in RadDatePicker you set the Step property with a DateTime value that has its Date components initialized with the values of the steps for each component. For instance, if we want to define a step for the days equal to 5 days, a step for the months equal to 2 months and a step for the years selector equal to 10 years, we do the following in XAML:

CopyXAML
<telerikInput:RadDatePicker x:Name="radDatePicker" Step="2/5/0010"/>

Here is a snapshot of how the control will look like in this case:

raddatepicker-features-timestep-1

By default, RadDatePicker will display values for each selectable date component that are multiples of the corresponding time step. You can, however, easily change this behavior by using the DayStepBehavior, MonthStepBehavior and YearStepBehavior properties.

Customizing the TimeStep behavior

To customize the behavior of the time step for RadDatePicker for each date component selector you should use one of the following properties:

  • DayStepBehavior
  • MonthStepBehavior
  • YearStepBehavior

These properties accept values defined by the DateStepBehavior enumeration which are as follows:

  • MultiplesOnly
  • BaseAndMultiples
  • StartFromBase

The MultiplesOnly option is the default one and implies that all selectable values that are displayed in the corresponding date component selector will be multiples of the defined time step.

The BaseAndMultiples option implies that all multiples of the defined time step, as well as the base value for the current date component (which is 1) will be displayed in the corresponding date component selector.

The StartFromBase option implies that the available values in the corresponding date component selector will be generated by starting from the base value and adding the defined time step to each next value (arithmetic progression).