using System;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
namespace OwlCore.WinUI.Converters.Color
{
///
/// A converter that converts a given to a .
///
public class ColorToSolidColorBrushConverter : IValueConverter
{
///
/// Converts a to a .
///
/// The to convert
/// The converted value.
public static SolidColorBrush Convert(Windows.UI.Color? value) => new SolidColorBrush(value ?? Windows.UI.Colors.Transparent);
///
public object Convert(object value, Type targetType, object parameter, string language)
{
return Convert(value as Windows.UI.Color?);
}
///
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return ((SolidColorBrush)value).Color;
}
}
}