using System;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace OwlCore.WinUI.Converters.Bools.Visible
{
///
/// A converter that converts a given a .
///
public sealed class BoolToVisibilityConverter : IValueConverter
{
///
/// Returns visible if the boolean is true.
///
/// boolean to check.
/// Collapsed if false, otherwise Visible.
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Visibility Convert(bool data) => data ? Visibility.Visible : Visibility.Collapsed;
///
public object Convert(object value, Type targetType, object parameter, string language)
{
return Convert(value is bool bValue && bValue);
}
///
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}