﻿using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;

namespace OperatorApp.Common.Converter
{
    /// <summary>
    /// Simple converter for <see cref="bool"/> to <see cref="Visibility"/>, commonly used in MVVM patterns to bind a bool model property to a view element visibility
    /// </summary>
    public class BooleanToVisibilityConverter : IValueConverter
    {
        object IValueConverter.Convert(object value, Type targetType, object parameter, string language)
        {
            return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
        }

        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
