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

namespace Valg.EVA.Skanning.Verify.Startup.Converters
{
    public class BooleanToScrollBarVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var b = (bool) value;
            if (b)
            {
                return ScrollBarVisibility.Auto;
            }
            else
            {
                return ScrollBarVisibility.Disabled;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var e = (ScrollBarVisibility) value;
            if (e == ScrollBarVisibility.Disabled)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}
