mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
32 lines
889 B
C#
32 lines
889 B
C#
using Avalonia.Data.Converters;
|
|
using Avalonia.Media;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Serein.Workbench.Avalonia.Converters
|
|
{
|
|
public class BoolToBrushConverter : IValueConverter
|
|
{
|
|
public IBrush TrueBrush { get; set; } = Brushes.LightBlue;
|
|
public IBrush FalseBrush { get; set; } = Brushes.Transparent;
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is bool boolValue)
|
|
{
|
|
return boolValue ? TrueBrush : FalseBrush;
|
|
}
|
|
return FalseBrush;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|