livia-test/Livia/Views/Converters/SeriesListToStringConverter.cs
2025-03-28 14:31:53 +08:00

19 lines
640 B
C#

using System.Globalization;
using System.Windows.Data;
using Livia.Models.Data;
namespace Livia.Views.Converters;
[ValueConversion(typeof(IEnumerable<Series>), typeof(string))]
public class SeriesListToStringConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is not IEnumerable<Series> list ? string.Empty : string.Join("\n", list.Select(i => i.SeriesDescription));
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}