c# - Validate Input via ValidationRule for Datagrid binded to DataTable -


q: how can manage datagrid validation rule validates input after changing row/cell , not before.

c: have datatgrid autogenerated columns , validation rule:

   <datagrid x:name="datagrid"                       rowdetailsvisibilitymode="visiblewhenselected"                        verticalscrollbarvisibility="auto"                       horizontalscrollbarvisibility="auto"                       enablerowvirtualization="true"                       autogeneratecolumns="true"                       itemssource="{binding}"                       selectionmode="extended">                        <datagrid.rowvalidationrules>                         <test:tablevalidationrules/>                       </datagrid.rowvalidationrules>             </datagrid> 

the datagrid binded datatable after filling data database ....

        sqladapter.fill(datatable);         datagrid.datacontext = datatable.defaultview; 

...

when start programmm data visualized expected , validation of datagrid triggered when building it. if add new data datagrid, e.g. in new row validation occurs on unchanged data without consideration of data wrote cell.

it seems forgot detail , solution not far. binding-problem between datatable , datagrid? or have trigger validation programatically? whats best way handle it?

the solution use validationstep property:

              <datagrid.rowvalidationrules >                     <test:tablevalidationrules validationstep="committedvalue"/>               </datagrid.rowvalidationrules> 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -