Last Updated: 30 Nov 2022 15:42 by Martin Ivanov
Martin Ivanov
Created on: 30 Nov 2022 15:42
Category: DatePicker
Type: Bug Report
DatePicker: MinValue setting doesn't work at runtime if it is set in the Opened event handler

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;