Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validating with Caliburn.Micro

Is there a way to validate a textbox input (using Regex) in a wpf application using Caliburn.Micro?

Thanks

like image 401
David Shochet Avatar asked Jun 21 '12 15:06

David Shochet


2 Answers

I wrote a small plugin for CM to enable fluent builder-style validation. Feel free to use it: https://github.com/AIexandr/Caliburn.Micro.Validation

like image 103
Alexandr Avatar answered Nov 13 '22 16:11

Alexandr


I'd suggest using an attribute-based approach. Have a look at this article:

Validation in WPF

The approach here is basically:

Inherit from a validation viewmodel base-class. This, in turn, could inherit from the Caliburn Screen/Conductor/etc base-classes quite happily

Once this is done all you need to is attribute up the properties you want to validate. This fits in really nicely with the CM approach.

like image 3
Faster Solutions Avatar answered Nov 13 '22 18:11

Faster Solutions