Windows 10 (Universal Windows App) data validation

人走茶凉 提交于 2019-12-05 14:24:34

I have quickly become a fan of using Prism, see this wonderful demonstration User input validation with Prism and data annotations on the UWP.

Its better than anything I could type here.

You can make a flyout inside a textbox.

As soon as the textbox loses focus with wrong input, the flyout shows up .

You can set the placament of the flyout on top/bottom/side of the textbox.

Best of luck !

The problem with Prism is that it uses a string indexer. But Bind in uwp just will not allow string indexes... Integers only! There are also some key features lacking such as coordination between entity view models and between them and the context.

I've done some R&D and it seems that the following are key elements of a good validator in uwp - use of strings as the binding target, to avoid dropping conversion exceptions - tracking conversion errors separately from validation errors - base class for the validating view model AND automatically generated derived classes specifying the property names - events to tie multiple view models together so that multiple parts of the ui are kept consistent - centralized error count and save / revert ability associated with the context

Anything out there that can do that? If so then I haven't found it yet.

sjb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!