using System; using System.Globalization; using Avalonia.Data.Converters; using XSDVisualiser.Models; namespace XSDVisualiser.Desktop.Converters { public class CardinalityToLabelConverter : IValueConverter { public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { if (value is not Occurs occ) return null; var min = occ.Min; var max = occ.MaxIsUnbounded ? "*" : occ.Max.ToString(culture); return $"[{min}..{max}]"; } public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotSupportedException(); } }