using System;
using System.Collections;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace OwlCore.WinUI.Converters.Bools.Visible
{
///
/// A simple converter that converts a given to an based on the presence of any items in the .
///
public sealed class CollectionAnyToVisibilityConverter : IValueConverter
{
///
/// Converts an an based on the presence of any items in the .
///
/// The .
/// A .
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Visibility Convert(ICollection value) => BoolToVisibilityConverter.Convert(CollectionAnyToBoolConverter.Convert(value));
///
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is ICollection collection)
{
return Convert(collection);
}
return Visibility.Collapsed;
}
///
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}