WPF DataGrid validation errors not clearing -


so have wpf datagrid, bound observablecollection. collection has validation on members, through idataerrorinfo. if edit cell in way invalid, , tab away before hitting enter, come , make valid, cell stop showing invalid, however, "!" @ head of row still there, , tooltip reference previous, invalid value.

not using mode=twoway datagridtextcolumns solves 1 version of problem, seems problem can appear out of other reasons well.

(anyone has explanation of why not using mode=twoway solves in first place close solution problem)

the same thing happened me datagridcomboboxcolumn tried dig little deeper.

the problem isn't binding in control displays errortemplate inside datagridheaderborder. binding visibility validation.haserror ancestor datagridrow (exactly should doing) , part working.

visibility="{binding (validation.haserror),                      converter={staticresource bool2visibilityconverter},                      relativesource={relativesource ancestortype={x:type datagridrow}}}"/> 

the problem validation error isn't cleared datagridrow once resolved. in version of problem, datagridrow started out 0 errors. when entered invalid value got 1 error so, far good. when resolved error jumped 3 errors, of same.

here tried resolve datatrigger set validationerrortemplate {x:null} if validation.errors.count wasn't 1. worked great first iteration once cleared error second time back. didn't have 3 errors anymore, had 7! after couple of more iterations above 10.

i tried clear errors manually doing updatesource , updatetarget on bindingexpressions no dice. validation.clearinvalid didn't have effect either. , looking through source code in toolkit didn't me anywhere :)

so don't have solutions thought should post findings anyway..

my "workaround" far hide errortemplate in datagridrowheader

<datagrid ...>     <datagrid.rowstyle>         <style targettype="datagridrow">             <setter property="validationerrortemplate" value="{x:null}"/>         </style>     </datagrid.rowstyle>     <!-- ... --> </datagrid> 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -