using System.Globalization; using Avalonia; using Avalonia.Data.Converters; using XSDVisualiser.Core; namespace XSDVisualiser.Desktop.Converters; public class OptionalToThicknessConverter : IValueConverter { private static readonly Thickness Required = new(2); private static readonly Thickness Optional = new(2); public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { if (value is Occurs occ) // We could vary thickness; for now same thickness regardless, reserved for future styling. return occ.Min == 0 ? Optional : Required; return Required; } public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { throw new NotSupportedException(); } }