Validating with Caliburn.Micro
Asked Answered
F

2

7

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

Thanks

Famished answered 21/6, 2012 at 15:50 Comment(1)
There's lyquidity.com/devblog/?p=71Spinning
S
3

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.

Sogdian answered 22/6, 2012 at 10:27 Comment(0)
M
5

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

Miscellany answered 28/1, 2015 at 21:6 Comment(0)
S
3

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.

Sogdian answered 22/6, 2012 at 10:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.