using System; using System.Windows; using System.Windows.Data; namespace DTS.Common.Converters { public class BooleanToItalicFontStyleConverter: IValueConverter { /// /// Converts a Boolean value to a FontStyle enumeration value. /// /// The Boolean value to convert. This value can be a standard Boolean value or a nullable Boolean value. /// /// /// /// The value to be passed to the target dependency property. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return value != null && (bool)value ? FontStyles.Italic : FontStyles.Normal; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return null; } } }