ValidatesOnExceptions for RadComboBox Text property

3 posts, 0 answers
  1. Andre
    Andre avatar
    2 posts
    Member since:
    Jan 2011

    Posted 20 Jan 2011 Link to this post

    It appears that RadComboBox does not support ValidatesOnExceptions for the Text property.  Here is what I am trying to use in my XAML.

    Text="{Binding InitialsText, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}"

    I need to use the Text property since the IsEditable property is true.  We need to allow users to enter a value or select from the list.

    When a validation error is thrown it is not trapped and I get an unhandled System.ComponentModel.DataAnnotations.ValidationException (code is below)

    /// <summary>
    /// text for the selected initials - required since field is editable
    /// </summary>
    [Required()]    //TODO AEO CAUSES ERRORS
    public string InitialsText
    {
        get { return initialsText; }
        set
        {
            SetProperty("InitialsText", ref initialsText, ref value);
     
            ValidationContext context = new ValidationContext(this, null, null);
            context.MemberName = "InitialsText";
            System.ComponentModel.DataAnnotations.Validator.ValidateProperty(value, context);
        }
    }

    Does the RadComboBox Text property support validation exceptions?  The approach I am using works perfectly for the RadComboBox SelectedItem property.

    Regards,
    Andre
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 26 Jan 2011 Link to this post

    Hello Andre,

    Thank you for contacting us.

    I have tried your approach and it seems to work properly. Could you please check out the sample project I am sending you.
    If you still experience difficulties please send us your project, so that we can run it here locally in order to track down the source of the problem.

    Kind regards,
    Konstantina
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Andre
    Andre avatar
    2 posts
    Member since:
    Jan 2011

    Posted 27 Jan 2011 Link to this post

    Konstantina,

    Thank you for your follow up.  I was able to determine my issue and the Text property does work.  By using DataAnnotations on my ViewModel, specifically a string type property, the validation exception was not being trapped on the object instantiation.  It is trapped properly when the user control is in use since the UI takes care of the error handling.  I have modified my code to account for this.

    Regards,
    Andre
Back to Top