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
<PackageReference Include="Kalicz.StrongTypes.Wpf" Version="1.1.0" />
<PackageVersion Include="Kalicz.StrongTypes.Wpf" Version="1.1.0" />
<PackageReference Include="Kalicz.StrongTypes.Wpf" />
paket add Kalicz.StrongTypes.Wpf --version 1.1.0
#r "nuget: Kalicz.StrongTypes.Wpf, 1.1.0"
#:package Kalicz.StrongTypes.Wpf@1.1.0
#addin nuget:?package=Kalicz.StrongTypes.Wpf&version=1.1.0
#tool nuget:?package=Kalicz.StrongTypes.Wpf&version=1.1.0
Kalicz.StrongTypes.Wpf
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Kalicz.StrongTypes (>= 1.1.0)
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 |