I am using the RadDateTimePicker on a custom appointment form. I am using the IDataErrorInfo interface on my custom appointment object in order to handle validation of fields. The data object field bound to the RadDateTimePicker control has the following validation method:
private string ValidateLorryHoldingAreaArrivalDate()
{
if ((!this.LorryHoldingAreaArrivalDate.HasValue) && (PlanType != PlanType.None) && (LorryHoldingAreaID.HasValue))
{
return "A lorry holding area arrival date is required!";
}
return null;
}
From this code we can see that the validation is conditional and depends on other field values.
The other fields that can alter the conditional validation result for the control are also firing the necessary PropertyChanged events e.g.
private Int32? _lorryHoldingAreaID;
public Int32? LorryHoldingAreaID
{
get
{
return Storage<Movement>()._lorryHoldingAreaID;
}
set
{
var storage = Storage<Movement>();
if (storage._lorryHoldingAreaID != value)
{
storage._lorryHoldingAreaID = value;
OnPropertyChanged(() => LorryHoldingAreaID);
OnPropertyChanged(() => LorryHoldingAreaArrivalDate); //required to reevaluate the validation
}
}
}
My problem is this. The red border does not appear on the RadDateTimePicker control when the validation method above fires and returns an error sting. The XAML for my RadDateTimePicker control is as follows:
<telerik:RadDateTimePicker
Grid.Row="6"
Grid.Column="3"
telerik:StyleManager.Theme="{StaticResource Theme}"
Margin="3"
SelectedValue="{Binding DialogViewModel.Occurrence.Appointment.LorryHoldingAreaArrivalDate, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}">
</telerik:RadDateTimePicker>
Any ideas why the red border isn't dynamically appearing when the underlying validation result changes to a failure state?