first edit
This commit is contained in:
35
XLIMS.MVVM/Converters/CompositeCollectionConverter.cs
Normal file
35
XLIMS.MVVM/Converters/CompositeCollectionConverter.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user