Bug with RadDateTimePicker and conditional validation?

2 posts, 0 answers
  1. Myles
    Myles avatar
    18 posts
    Member since:
    Mar 2012

    Posted 11 May 2012 Link to this post

    Hi,

    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?

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 17 May 2012 Link to this post

    Hello Myles,

    I've tried to reproduce this issue in a simple project but without much success. You can find it attached to this thread. Can you please try it and let us know what is different in your case? Thanks

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top