Exemple #1
0
 string IDataErrorInfo.this[string columnName]
 {
     get
     {
         return(IDataErrorInfoHelper.GetErrorText(this, columnName));
     }
 }
 public string this[string columnName]
 {
     get
     {
         Error = IDataErrorInfoHelper.GetErrorText(this, columnName);
         return(Error);
     }
 }
 string IDataErrorInfo.this[string columnName] {
     get {
         //_Obtains validation attributes applied to the corresponding property and combines errors provided by them into one.
         //_Since code generated by Scaffolding Wizards supports the IDataErrorInfo interface out of the box, the error will be displayed in UI.
         //_The Save command will also be disabled until all errors are fixed.
         //_To learn more about IDataErrorInfo support in Scaffolding Wizards, refer to the https://documentation.devexpress.com/#WPF/CustomDocument17157 topic
         return(IDataErrorInfoHelper.GetErrorText(this, columnName));
     }
 }
        public void ValidationEntityWithDisplayNameAttributesTest()
        {
            var entity = new ValidationEntityWithDisplayNameAttributes {
                PropertyWithDisplayNameAttribute    = "asdf",
                PropertyWithDisplayAttribute        = "asdf",
                PropertyWithDisplayAttribute_Fluent = "asdf",
            };

            Assert.AreEqual("The field _PropertyWithDisplayNameAttribute_ must be a string with a maximum length of 2.", IDataErrorInfoHelper.GetErrorText(entity, "PropertyWithDisplayNameAttribute"));
            Assert.AreEqual("The field _PropertyWithDisplayAttribute_ must be a string with a maximum length of 2.", IDataErrorInfoHelper.GetErrorText(entity, "PropertyWithDisplayAttribute"));
        }
 // ReSharper disable once StyleCop.SA1126
 public string this[string columnName] => IDataErrorInfoHelper.GetErrorText(this, columnName);
        protected virtual bool HasValidationErrors()
        {
            IDataErrorInfo dataErrorInfo = Entity as IDataErrorInfo;

            return(dataErrorInfo != null && IDataErrorInfoHelper.HasErrors(dataErrorInfo));
        }
Exemple #7
0
 bool CanOk(CancelEventArgs parameter)
 {
     return(String.IsNullOrWhiteSpace(IDataErrorInfoHelper.GetErrorText(this, "EmailAddress")));
 }