46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
![]() |
using System;
|
|||
|
using System.Collections.ObjectModel;
|
|||
|
using System.Globalization;
|
|||
|
using System.Windows.Data;
|
|||
|
using DI_Electrical.Models;
|
|||
|
|
|||
|
namespace DI_Electrical.Views.CustomControl
|
|||
|
{
|
|||
|
public class CollectionToStringConverter : IValueConverter
|
|||
|
{
|
|||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
{
|
|||
|
ObservableCollection<ec_dataitemdetail> WHCPUs = value as ObservableCollection<ec_dataitemdetail>;
|
|||
|
if (WHCPUs != null)
|
|||
|
{
|
|||
|
string sWHCPU = "";
|
|||
|
for (int i = 0; i < WHCPUs.Count; i++)
|
|||
|
{
|
|||
|
if (i!= WHCPUs.Count-1)
|
|||
|
{
|
|||
|
if (WHCPUs[i] != null)
|
|||
|
{
|
|||
|
sWHCPU = sWHCPU + WHCPUs[i].DataItemCode + "|";
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (WHCPUs[i] != null)
|
|||
|
{
|
|||
|
sWHCPU = sWHCPU + WHCPUs[i].DataItemCode;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
return sWHCPU;
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
{
|
|||
|
throw new NotImplementedException();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|