How can I validate multiple properties when any of them changes?

后端 未结 4 1501

I have two date fields: StartDate and EndDate. StartDate must be earlier than EndDate.

If the user changes the StartDate to something greater than the EndDate, a red

4条回答
  •  执笔经年
    2020-12-08 16:03

    You can also subscribe to the SelectedDateChanged event handler and update needed binding.

    BindingExpression expression = datePickerStartDate.GetBindingExpression(DatePicker.SelectedDateProperty);
    if (expression != null)
    {
        expression.UpdateSource();
    }
    

提交回复
热议问题