30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
Plaintext
using System;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace DTS.Common.Converters
|
|
{
|
|
public class BooleanToItalicFontStyleConverter : IValueConverter
|
|
{
|
|
/// <summary>
|
|
/// Converts a Boolean value to a FontStyle enumeration value.
|
|
/// </summary>
|
|
/// <param name="value">The Boolean value to convert. This value can be a standard Boolean value or a nullable Boolean value.</param>
|
|
/// <param name="culture"></param>
|
|
/// <param name="parameter"></param>
|
|
/// <param name="targetType"></param>
|
|
/// <returns>The value to be passed to the target dependency property.</returns>
|
|
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;
|
|
}
|
|
}
|
|
}
|