40 lines
1.8 KiB
C#
40 lines
1.8 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace DTS.Common.Converters
|
|
{
|
|
/// <summary>
|
|
/// Represents the converter that converts Text (GroupName) values to and from <see cref="Visibility">Visibility</see> enumeration values.
|
|
/// </summary>
|
|
public class GroupNameToVisibilityConverter : IValueConverter
|
|
{
|
|
/// <summary>
|
|
/// Converts a Group Name value to a Visibility 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="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 && value.ToString().Trim().StartsWith("Graph")) { return Visibility.Visible; }
|
|
return Visibility.Collapsed;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="value">A Visibility enumeration value.</param>
|
|
/// <param name="targetType">This parameter is not used.</param>
|
|
/// <param name="parameter">This parameter is not used.</param>
|
|
/// <param name="culture">This parameter is not used.</param>
|
|
/// <returns>The value to be passed to the source object.</returns>
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|