Initial work for AbstractUI options

This commit is contained in:
Yoshi Askharoun
2021-08-05 20:45:26 -05:00
parent ba28eb7ef7
commit 3e3228245d
63 changed files with 2392 additions and 68 deletions
@@ -0,0 +1,42 @@
using System;
using System.Collections;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Data;
namespace OwlCore.Wpf.Converters.Bools.Visible
{
/// <summary>
/// A converter that converts a given <see cref="ICollection"/> to an <see cref="Visibility"/> based on the presence of any items in the <see cref="ICollection"/>.
/// </summary>
public sealed class CollectionNotAnyToVisibilityConverter : IValueConverter
{
/// <summary>
/// Converts an <see cref="ICollection"/> an <see cref="Visibility"/> based on the presence of any items in the <see cref="ICollection"/>.
/// </summary>
/// <param name="value">The <see cref="ICollection"/>.</param>
/// <returns>A <see cref="Visibility"/>.</returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Visibility Convert(ICollection value) => BoolToVisibilityConverter.Convert(CollectionNotAnyToBoolConverter.Convert(value));
/// <inheritdoc/>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ICollection collection)
{
return Convert(collection);
}
return Visibility.Collapsed;
}
/// <inheritdoc/>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}