How use the validation binding in the Value option and set a text value

2 posts, 0 answers
  1. Alexandre
    Alexandre avatar
    8 posts
    Member since:
    May 2018

    Posted 06 Jun 2018 Link to this post

    Hi, I am creating a project using the valiadtion as IDataErrorInfo, but I need to create a simple edit form that the RadMaskedTextInput components have the Value option filled with a value.


    This is my example TextInput:

                    <telerik:RadMaskedTextInput Value="{Binding Interessado, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                                                EmptyContent="Nome ou razão social"


    And this is my validation class:

        public class Validations : IDataErrorInfo
            public string Interessado { get; set; }

            #region IDataErrorInfo

            public string this[string columnName]
                    if ("Interessado" == columnName)
                        if (String.IsNullOrEmpty(Interessado))
                            return "Campo Nome do Interessado é obrigatório!";
                    return "";

            public string Error
                get { throw new NotImplementedException(); }


    So, how can I set the Value with a text (because I am using the Value option for Binding)?

  2. Dinko
    Dinko avatar
    1184 posts

    Posted 11 Jun 2018 Link to this post

    Hi Alexandre,

    Thank you for the provided code snippets.

    If I have understood your questions correctly you want to set a default value. Correct me if I am in the wrong direction. In this case, you can set the Interessado property in the constructor of the Validations class. I have created a sample project, based on the provided code snippets, which demonstrates this approach.

    Give this project a try and let me know if it works for you. If not, can you elaborate more on your approach?

    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top