using System.Globalization; using System.Windows; using System.Windows.Data; namespace EngineeringSync.TrayApp.Converters; /// Gibt "Neues Projekt" oder "Projekt bearbeiten" zurück. public class NewEditHeaderConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => value is true ? "Neues Projekt anlegen" : "Projekt bearbeiten"; public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException(); } /// Gibt Visibility.Visible zurück wenn der String nicht leer ist. public class StringToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible; public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException(); } /// Invertiert Boolean für Visibility (true = Collapsed, false = Visible). public class InverseBoolToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => value is true ? Visibility.Collapsed : Visibility.Visible; public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException(); }