Files

41 lines
1.5 KiB
C#
Raw Permalink Normal View History

using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace EngineeringSync.Setup.Converters;
public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object v, Type t, object p, CultureInfo c) =>
v is true ? Visibility.Visible : Visibility.Collapsed;
public object ConvertBack(object v, Type t, object p, CultureInfo c) =>
throw new NotSupportedException();
}
public class BoolToInverseVisibilityConverter : IValueConverter
{
public object Convert(object v, Type t, object p, CultureInfo c) =>
v is true ? Visibility.Collapsed : Visibility.Visible;
public object ConvertBack(object v, Type t, object p, CultureInfo c) =>
throw new NotSupportedException();
}
/// <summary>
/// Gibt "Jetzt installieren" wenn true (letzter normaler Schritt), sonst "Weiter".
/// </summary>
public class LastStepLabelConverter : IValueConverter
{
public object Convert(object v, Type t, object p, CultureInfo c) =>
v is true ? "Jetzt installieren" : "Weiter";
public object ConvertBack(object v, Type t, object p, CultureInfo c) =>
throw new NotSupportedException();
}
public class StringToVisibilityConverter : IValueConverter
{
public object Convert(object v, Type t, object p, CultureInfo c) =>
string.IsNullOrEmpty(v as string) ? Visibility.Collapsed : Visibility.Visible;
public object ConvertBack(object v, Type t, object p, CultureInfo c) =>
throw new NotSupportedException();
}