Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Change validation Attribute's parameter at runtime

$
0
0

hi

i am using a custom validation attribute with IDataErrorInfo

this class is:

 
  [AttributeUsage(AttributeTargets.Property)]
    public class ValidateAttribute : ValidationAttribute
        {
              public bool IsRequired { get; set; }

       }

and i use in model:

 public partial class Product : EntityBase    

{

   [ValidateAttribute(IsRequired = true)]
       public int ProductID { get; set; }

    [ValidateAttribute(IsRequired = true)]
       public int ProductName { get; set; }

}


how to set or change "IsRequired=false" from view model in wpf for All properties in Product Class?

i like to manualy Disable validation of properties in viewmodel

please help me

thanks



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>