31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
|
|
using System;
|
|||
|
|
using System.Windows.Data;
|
|||
|
|
|
|||
|
|
namespace DTS.Common.Converters
|
|||
|
|
{
|
|||
|
|
public class InverseBooleanToOpacityConverter : IValueConverter
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Converts a Boolean value to a Opacity to show user control enable/disable.
|
|||
|
|
/// </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="targetType">This parameter is not used.</param>
|
|||
|
|
/// <param name="parameter">The converter parameter to use.</param>
|
|||
|
|
/// <param name="culture">This parameter is not used.</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)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (value != null && (bool)value)
|
|||
|
|
return 1.0;
|
|||
|
|
return 0.5;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|