File: Controls\FallbackBrushConverter.cs
Web Access
Project: src\src\Microsoft.DotNet.Wpf\src\Themes\PresentationFramework.Fluent\PresentationFramework.Fluent_4ysjpyxx_wpftmp.csproj (PresentationFramework.Fluent)
using System;
using System.Windows.Data;
using System.Globalization;
using System.Windows.Media;
 
namespace Fluent.Controls
{
    internal class FallbackBrushConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is SolidColorBrush brush)
            {
                return brush;
            }
 
            if (value is Color color)
            {
                return new SolidColorBrush(color);
            }
 
            // We draw red to visibly see an invalid bind in the UI.
            return Brushes.Red;
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}