c# - How to create XAML with ValidationRole on runtime -


i dinamicaly creare xaml drag , drop on controls. create text bindind on textbox, how add validationrole on binding. how create this:

<textbox.text>          <binding path="model.txt1.value" updatesourcetrigger="propertychanged" validatesondataerrors="true">             <binding.validationrules>                <localval:requiredvalidate />             </binding.validationrules>          </binding>       </textbox.text> 

this code:

   frameworkelement selectedobject = fe_dragged_control;                     dependencyproperty property =                         controlbindingextensions.getdependencypropertyfromname("text",                                                                                selectedobject.gettype());                     binding binding = new binding("model." + selectedobject.name + ".value");                     binding.updatesourcetrigger = updatesourcetrigger.propertychanged;                     binding.validatesondataerrors = true;                     requiredvalidate role = new requiredvalidate();                     binding.validationrules.add(role);                     selectedobject.setbinding(property, binding); 

thank you.


Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -