Files
XLIMS/XLIMS.MVVM/Converters/CompositeCollectionConverter.cs
Курнат Андрей f0e11d6379 first edit
2026-01-31 16:11:36 +03:00

36 lines
1.0 KiB
C#

using System;
using System.Collections;
using System.Windows.Data;
namespace XLIMS.MVVM.Converters
{
[ValueConversion(typeof(object),typeof(CompositeCollection))]
public class CompositeCollectionConverter : IMultiValueConverter
{
public object Convert(object[] values
, Type targetType
, object parameter
, System.Globalization.CultureInfo culture)
{
var res = new CompositeCollection();
foreach (var item in values)
if (item is IEnumerable)
res.Add(new CollectionContainer()
{
Collection = item as IEnumerable
});
else res.Add(item);
return res;
}
public object[] ConvertBack(object value
, Type[] targetTypes
, object parameter
, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}