using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Data.Converters; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ShakerApp.Convert { internal class MenuItemConverter : IValueConverter { public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { var list = new AvaloniaList(); if(value is IList menuItems) { menuItems.ToList().ForEach(x =>list.Add(x.ConverterToMenuItem())); } return list; } public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { throw new NotImplementedException(); } } }