开发者

WPF - PRISM After view activation, validation drops

To switch view in WPF/PRISM I use activate/deactivate on the region.

I'm having a base class with IDataErrorInfo implemented, when my module loads my view, the validation instantly happens. When I switch towards an other view and back, the validation is gone.. No tooltips or markings that the fields contain errors. The only thing that is stopping is my safeguard check on my "submit"-button.

Not very user-fr开发者_运维问答iendly I suppose.

So I'm currently looking towards a way to re-evaluate the view after activation...

[Code on request]


You can allways clear the Views and add them again to the RegionManager on navigation. Usually that is related to custom code, and it's hard to pinpoint others errors, it can be something you're getting from the container that is a singleton, or when you're re-using the ViewModel you're not validating anymore, etc.

The clear all views in the RegionManager region then activate again is the brute force solution that usually works, the good practice solution is somewhere between taking care of that in the ViewModel or writing your own RegionBehavior and adding it to Prism in the Bootstrapper.

You have some examples of RegionBehavior classes on both of Prism's Reference Implementations.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜