using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace DatabaseEditor.Converters
{
    [ValueConversion(typeof(bool), typeof(GridLength))]
    public class BoolToGridLengthConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var booleanValue = value as bool?;
            return booleanValue == true ? new GridLength(1, GridUnitType.Auto) : new GridLength(0);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}