2020-11-27 18:51:02 +08:00
|
|
|
using System;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
2021-02-23 18:03:37 +08:00
|
|
|
#nullable enable
|
2020-11-27 18:51:02 +08:00
|
|
|
namespace BililiveRecorder.WPF.Converters
|
|
|
|
{
|
|
|
|
public class MultiBoolToValueConverter : IMultiValueConverter
|
|
|
|
{
|
2021-02-23 18:03:37 +08:00
|
|
|
public object? FalseValue { get; set; }
|
|
|
|
public object? TrueValue { get; set; }
|
2020-11-27 18:51:02 +08:00
|
|
|
|
2021-02-23 18:03:37 +08:00
|
|
|
public object? Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
2020-11-27 18:51:02 +08:00
|
|
|
{
|
|
|
|
foreach (var value in values)
|
|
|
|
{
|
|
|
|
if ((value is bool boolean) && boolean == false)
|
|
|
|
{
|
2021-01-01 14:46:27 +08:00
|
|
|
return this.FalseValue;
|
2020-11-27 18:51:02 +08:00
|
|
|
}
|
|
|
|
}
|
2021-01-01 14:46:27 +08:00
|
|
|
return this.TrueValue;
|
2020-11-27 18:51:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|