ModelValidator 1.0.0

Install-Package ModelValidator -Version 1.0.0
dotnet add package ModelValidator --version 1.0.0
<PackageReference Include="ModelValidator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ModelValidator --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ModelValidator, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ModelValidator as a Cake Addin
#addin nuget:?package=ModelValidator&version=1.0.0

// Install ModelValidator as a Cake Tool
#tool nuget:?package=ModelValidator&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ModelValidator

Example model:

public class ExampleModel : ModelValidatorBase
{
    /// <summary>
    /// Example string.
    /// </summary>
    [Required(AllowEmptyStrings = false, ErrorMessage = "Input text")]
    [StringLength(maximumLength: 10, MinimumLength = 4, ErrorMessage = "Min length: {1}, max length: {0}")]
    public string ExampleString { get; set; }

    /// <summary>
    /// Example int.
    /// </summary>
    [Range(minimum: 5, maximum: 10, ErrorMessage = "Min value: {0}, max value: {1}")]
    public int ExampleInt { get; set; }
}

Binding example:

<StackPanel>
    <TextBox Text="{Binding TestModel.ExampleString, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
    <TextBox Text="{Binding TestModel.ExampleInt, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
</StackPanel>

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 165 7/15/2020

Auto validation model for WPF