Kalicz.StrongTypes.Wpf 1.1.0

dotnet add package Kalicz.StrongTypes.Wpf --version 1.1.0
                    
NuGet\Install-Package Kalicz.StrongTypes.Wpf -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kalicz.StrongTypes.Wpf" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kalicz.StrongTypes.Wpf" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Kalicz.StrongTypes.Wpf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kalicz.StrongTypes.Wpf --version 1.1.0
                    
#r "nuget: Kalicz.StrongTypes.Wpf, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kalicz.StrongTypes.Wpf@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kalicz.StrongTypes.Wpf&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Kalicz.StrongTypes.Wpf&version=1.1.0
                    
Install as a Cake Tool

Kalicz.StrongTypes.Wpf

NuGet version Downloads License

WPF MVVM binding support for Kalicz.StrongTypes. With this package referenced and UseStrongTypes() called once in App.OnStartup, two-way binding from a TextBox.Text to a strong-typed view-model property just works.

Why a separate package

WPF's binding pipeline routes string → T through TypeDescriptor.GetConverter(T) and never consults IParsable<T> directly. Without a converter, typing into a TextBox bound to a strong-typed property silently fails to update the source. The core Kalicz.StrongTypes package deliberately avoids any UI dependency, so the wiring lives here.

Usage

Call this.UseStrongTypes() once in App.OnStartup. One call covers every strong type — including every closed instantiation of the generic numeric wrappers (Positive<int>, Negative<decimal>, …) — because the package installs a TypeDescriptionProvider that synthesizes the converter on demand the first time WPF asks for it.

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        this.UseStrongTypes();
        base.OnStartup(e);
    }
}

After registration, a plain MVVM binding works:

<TextBox Text="{Binding Name,
                        Mode=TwoWay,
                        UpdateSourceTrigger=PropertyChanged,
                        ValidatesOnExceptions=True}" />

…where Name is a view-model property of type NonEmptyString. ValidatesOnExceptions=True turns the strong type's ArgumentException (thrown by Create / Parse when validation fails) into a ValidationError on the binding, which in turn drives the standard WPF "invalid input" red border.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.0 95 5/5/2026