Unplanned
Last Updated: 22 Nov 2022 14:52 by Martin Ivanov
The DatePicker allows you to set the MinValue and MaxValue properties that limits the selectable dates in the control. In that case, all values outside of the min/max range will be displayed as greyed out (disabled) numbers for the different segments - day, month, year. 

If the Value of the control is not explicitly set, the DateTime.Now value is used. After the change of the Value through the UI, the currently selected DateTime will be copied based on the changed segment (day, month or year) along with its time part (ex: 4:46PM). In that case, you may not be able to select the last value assigned to MaxValue of the control, because the value change behavior is not very obvious. 

For example: the user can set MaxValue to 29 Nov 2022 12:00:00AM, and the current value can be 22 Nov 2022 4:49:23PM. The time value is not visible. If you open the drop down with the segments, you will won't be able to select 29 Nov, because that would mean that you will select 29 Nov at 4:49:32PM, which has a bigger value then the explicitly assigned MaxValue which is the 29 Nov, but 12:00:00AM.

Add an API that allows you to skip the time part when comparing dates, and use only the Date of the DateTime objects.
Unplanned
Last Updated: 30 Nov 2022 15:42 by Martin Ivanov

Setting the MaxValue, MinValue and Value properties at runtime doesn't work when the settings are done in the Opened event handler of RadDatePicker. The DateTime values of the properties are updated as expected, but this is not reflected in the UI.

To work this around, you can use the Click event of the internal DateTimePickerButton, instead of the Opened event.

private void DatePicker_Loaded(object sender, RoutedEventArgs e)
{
	var btn = this.datePicker.FindChildByType<DateTimePickerButton>();
	btn.Click += Btn_Click;            
}

private void Btn_Click(object sender, RoutedEventArgs e)
{
	var vm = (MainViewModel)this.datePicker.DataContext;
	this.datePicker.MinValue = DateTime.Today;
}