sourcegit/Converters/BoolToCollapsed.cs

38 lines
1.2 KiB
C#
Raw Permalink Normal View History

2020-07-03 00:24:31 -07:00
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace SourceGit.Converters {
/// <summary>
/// Same as BoolToVisibilityConverter.
/// </summary>
public class BoolToCollapsed : IValueConverter {
/// <summary>
/// Implement IValueConverter.Convert
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
return (bool)value ? Visibility.Visible : Visibility.Collapsed;
}
/// <summary>
/// Implement IValueConverter.ConvertBack
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
throw new NotImplementedException();
}
}
}