![]() |
VOOZH | about |
dotnet add package ValueConverters.Annotations --version 3.1.22
NuGet\Install-Package ValueConverters.Annotations -Version 3.1.22
<PackageReference Include="ValueConverters.Annotations" Version="3.1.22" />
<PackageVersion Include="ValueConverters.Annotations" Version="3.1.22" />Directory.Packages.props
<PackageReference Include="ValueConverters.Annotations" />Project file
paket add ValueConverters.Annotations --version 3.1.22
#r "nuget: ValueConverters.Annotations, 3.1.22"
#:package ValueConverters.Annotations@3.1.22
#addin nuget:?package=ValueConverters.Annotations&version=3.1.22Install as a Cake Addin
#tool nuget:?package=ValueConverters.Annotations&version=3.1.22Install as a Cake Tool
This library contains a collection of most commonly used implementations of the IValueConverter interface. ValueConverters are used to convert values bound from the view to the view model - and in some cases also backwards.
This library is available on NuGet: https://www.nuget.org/packages/ValueConverters/
Use the following command to install ValueConverters using NuGet package manager console:
PM> Install-Package ValueConverters
If your target platform is Xamarin.Forms use following NuGet package:
PM> Install-Package ValueConverters.Forms
If your target platform is .NET MAUI use following NuGet package:
PM> Install-Package ValueConverters.MAUI
The usage of converters is on all platforms more or less the same:
Define a converter in the Resources section of a UserControl, Window, Page, etc. Specify options if required.
<UserControl.Resources>
<ResourceDictionary>
<converters:DateTimeConverter x:Key="DateTimeConverter" Format="d" MinValueString="-"/>
</ResourceDictionary>
</UserControl.Resources>
Apply the converter as a StaticResource:
<TextBox Text="{Binding EmployeeDetailViewModel.Birthdate, Converter={StaticResource DateTimeConverter}}"/>
EnumWrapperConverter is used to display localized enums. The concept is fairly simple: Enums are annotated with localized string resources and wrapped into EnumWrapper<TEnumType>. The view uses the EnumWrapperConverter to extract the localized string resource from the resx file. Following step-by-step instructions show how to localize and bind a simple enum type in a WPF view:
[DataContract]
public enum PartyMode
{
[EnumMember]
[Display(Name = "PartyMode_Off", ResourceType = typeof(PartyModeResources))]
Off,
// …
}
Create StringResources.resx and define strings with appropriate keys (e.g. "PartyMode__Off"). Make sure PublicResXFileCodeGenerator is used to generate the .Designer.cs file. (If ResXFileCodeGenerator is used, the resource lookup operations may require more time to complete).
Create StringResources.resx for other languages (e.g. StringResources.de.resx) and translate all strings accordingly. Use Multilingual App Toolkit for easy localization of the defined string resources.
Expose enum property in the ViewModel.
public PartyMode PartyMode
{
get { return this.partyMode; }
set { this.partyMode = value;
this.OnPropertyChanged(() => this.PartyMode); }
}
<Label Content="{Binding PartyMode, Converter={StaticResource EnumWrapperConverter}}" />
That’s it. If you want to change the UI language at runtime, don’t forget to call OnPropertyChanged after changing CurrentUICulture. There is a WPF sample app available.
Value converters are culture-aware. Both the Convert and ConvertBack methods have a culture parameter that indicates the cultural information. If cultural information is irrelevant to the conversion, then you can ignore that parameter in your custom converter.
By default, the culture parameter is provided by the underlaying platform. If you want to override the provided culture, use the property PreferredCulture. You can select from one of the following override behaviors:
This is particularly helpful in WPF applications, since it is a known/unresolved bug that the provided culture parameter does not update when CultureInfo.CurrentCulture or CultureInfo.CurrentUICulture is updated. Use ValueConvertersConfig.DefaultPreferredCulture to configure the default converter culture for all converters.
System.Windows.Data.IValueConverter Interface https://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter(v=vs.110).aspx
Windows.UI.Xaml.Data.IValueConverter interface: https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.data.ivalueconverter
ValueConverters.NET is Copyright © 2021 Thomas Galliker. Free for non-commercial use. For commercial use please contact the author.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp1.0 netcoreapp1.0 was computed. netcoreapp1.1 netcoreapp1.1 was computed. netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard1.0 netstandard1.0 is compatible. netstandard1.1 netstandard1.1 was computed. netstandard1.2 netstandard1.2 was computed. netstandard1.3 netstandard1.3 was computed. netstandard1.4 netstandard1.4 is compatible. netstandard1.5 netstandard1.5 was computed. netstandard1.6 netstandard1.6 is compatible. netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net45 net45 was computed. net451 net451 was computed. net452 net452 was computed. net46 net46 was computed. net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 is compatible. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen30 tizen30 was computed. tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Universal Windows Platform | uap uap was computed. uap10.0 uap10.0 was computed. |
| Windows Phone | wp8 wp8 was computed. wp81 wp81 was computed. wpa81 wpa81 was computed. |
| Windows Store | netcore netcore was computed. netcore45 netcore45 was computed. netcore451 netcore451 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on ValueConverters.Annotations:
| Package | Downloads |
|---|---|
|
ValueConverters
A collection of commonly used IValueConverters for WPF applications |
|
|
ValueConverters.MAUI
A collection of commonly used IValueConverters for .NET MAUI applications |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.2.8-pre | 135 | 5/26/2026 |
| 4.2.7-pre | 112 | 5/24/2026 |
| 4.2.6-pre | 121 | 5/23/2026 |
| 4.2.5-pre | 117 | 5/23/2026 |
| 4.2.3-pre | 118 | 5/22/2026 |
| 4.2.2-pre | 120 | 5/22/2026 |
| 4.2.1-pre | 141 | 5/15/2026 |
| 4.2.0-pre | 128 | 5/15/2026 |
| 4.1.16-pre | 300 | 1/7/2026 |
| 4.1.15-pre | 136 | 12/30/2025 |
| 4.1.11-pre | 138 | 12/30/2025 |
| 4.1.10-pre | 149 | 12/30/2025 |
| 4.1.6-pre | 343 | 12/17/2025 |
| 4.1.5-pre | 316 | 12/17/2025 |
| 4.1.3-pre | 337 | 12/17/2025 |
| 4.1.2-pre | 318 | 12/17/2025 |
| 4.0.16-pre | 340 | 12/17/2025 |
| 4.0.9-pre | 283 | 10/3/2025 |
| 4.0.6-pre | 656 | 5/7/2025 |
| 3.1.22 | 13,616 | 9/26/2024 |
1.0.0
- Initial release