/// <summary> /// Value converter between bool and IsChecked property value (bool?) /// </summary> [ValueConversion(typeof(bool), typeof(bool?))] public class IsCheckedConverter : IValueConverter { #region IValueConverter Members /// <summary> /// Converts the specified value. /// </summary> /// <param name="value">The value.</param> /// <param name="targetType">Type of the target.</param> /// <param name="parameter">The parameter.</param> /// <param name="culture">The culture.</param> /// <returns></returns> public object Convert( object value, Type targetType, object parameter, CultureInfo culture) { return (bool)value; } /// <summary> /// Converts the value back. /// </summary> /// <param name="value">The value.</param> /// <param name="targetType">Type of the target.</param> /// <param name="parameter">The parameter.</param> /// <param name="culture">The culture.</param> /// <returns></returns> public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture) { bool? isChecked = (bool?)value; if (isChecked == null) { return false; } else { return isChecked == true; } } #endregion IValueConverter Members }