using System; using System.Windows; using System.Windows.Data; using System.Globalization; namespace BillPayManager { /// <summary> /// Converts <c>null</c> values to <see cref="DependencyProperty.UnsetValue"/>. /// <remarks> /// This converter is intented for use in situations when the binding target /// does not correctly handle <c>null</c> values. This is the case for example /// with some WPF UI controls. /// </remarks> /// </summary> public class NullToUnsetConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return value ?? DependencyProperty.UnsetValue; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { // No conversion applied return value; } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)