mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
26 lines
737 B
C#
26 lines
737 B
C#
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using System.Windows.Markup;
|
|
|
|
namespace TRX_InstallerLib.Utils;
|
|
|
|
public sealed class ConditionalMarkupConverter : MarkupExtension, IValueConverter
|
|
{
|
|
public object FalseValue { get; set; } = new();
|
|
public object TrueValue { get; set; } = new();
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return value is true ? TrueValue : FalseValue;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
{
|
|
return this;
|
|
}
|
|
}
|