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: 27 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 (12 months ago)
- Last Synced: 2024-10-30T01:02:41.412Z (about 2 months ago)
- Topics: avalonia, validation, wpf, xaml
- Language: C#
- Homepage:
- Size: 479 KB
- Stars: 72
- Watchers: 3
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-avalonia - ReactiveValidation - Validating properties with messages on UI using fluent-style rules. (Libraries & Extensions / MVVM & MVP & MVU)
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).