TRX/tools/installer/TRX_InstallerLib/Utils/ConditionalMarkupConverter.cs
lahm86 e16fcda94b tools/installer: create common installer library
This creates a generic common installer WPF library for both games.
2025-03-30 12:34:54 +01:00

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;
}
}