Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karnah/reactivevalidation
A small validation library for WPF and Avalonia which uses a fluent interface and allows display messages near controls in GUI with MVVM
https://github.com/karnah/reactivevalidation
avalonia validation wpf xaml
Last synced: 26 days ago
JSON representation
A small validation library for WPF and Avalonia which uses a fluent interface and allows display messages near controls in GUI with MVVM
- Host: GitHub
- URL: https://github.com/karnah/reactivevalidation
- Owner: Karnah
- License: mit
- Created: 2018-04-25T17:41:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-02T17:43:32.000Z (10 months ago)
- Last Synced: 2024-09-25T09:08:15.984Z (about 1 month ago)
- Topics: avalonia, validation, wpf, xaml
- Language: C#
- Homepage:
- Size: 479 KB
- Stars: 74
- Watchers: 3
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ReactiveValidation
A small validation library for WPF and Avalonia which uses a fluent interface and allows display messages near controls in GUI with MVVM.
Inspired [FluentValidation](https://github.com/JeremySkinner/FluentValidation) by Jeremy Skinner.## Sample
```csharp
public class CarViewModel : ValidatableObject
{
public CarViewModel()
{
Validator = GetValidator();
}private IObjectValidator GetValidator()
{
var builder = new ValidationBuilder();builder.RuleFor(vm => vm.Make).NotEmpty();
builder.RuleFor(vm => vm.Model).NotEmpty().WithMessage("Please specify a car model");
builder.RuleFor(vm => vm.Mileage).GreaterThan(0).When(model => model.HasMileage);
builder.RuleFor(vm => vm.Vin).Must(BeAValidVin).WithMessage("Please specify a valid VIN");
builder.RuleFor(vm => vm.Description).Length(10, 100);return builder.Build(this);
}private bool BeAValidVin(string vin)
{
// Custom vin validating logic goes here.
}// Properties with realization INotifyPropertyChanged goes here.
}
```## WPF
* [Quick start](https://github.com/Karnah/ReactiveValidation/wiki/WPF.-Quick-start)
* [Project with samples](https://github.com/Karnah/ReactiveValidation/tree/master/src/ReactiveValidation.Wpf.Samples)## Avalonia
* [Quick start](https://github.com/Karnah/ReactiveValidation/wiki/Avalonia.-Quick-start)
* [Project with samples](https://github.com/Karnah/ReactiveValidation/tree/master/src/ReactiveValidation.Avalonia.Samples)## Documentation
About all features you can read in the [documentation](https://github.com/Karnah/ReactiveValidation/wiki).