开发者

WPF Validation on submit using IDataErrorInfo

Is there a simple way to only show validation errors开发者_如何学JAVA when a form is being submitted in WPF?

I'm using MVVM pattern, Caliburn.Micro and IDataErrorInfo. For most of my simple object add/edit forms, the constant red boxes is fine but for a particular screen I'd like to only show the error(s) once a user tries to submit- I am perfectly happy to have the submit button enabled all the time...


You could have a textbox that would bind to your viewmodel's IDataErrorInfo Error member. Have the form's Error member aggregate the list of errors from your form fields and only set the textblock to visibile on sumbit if Errors isn't empty.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜