51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using SWS.Model;
|
|
|
|
namespace SWS.Commons.Helper.Converter
|
|
{
|
|
public class ColumnValueConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (parameter.ToString().Equals("类型"))
|
|
{
|
|
if (value is string ParentID)
|
|
{
|
|
if (string.IsNullOrEmpty(ParentID))
|
|
{
|
|
return "信号";
|
|
}
|
|
else
|
|
{
|
|
return "虚拟点";
|
|
}
|
|
|
|
}
|
|
}
|
|
if (parameter.ToString().Equals("归属专业"))
|
|
{
|
|
if (value is bool ParentID)
|
|
{
|
|
if (ParentID)
|
|
{
|
|
return "E";
|
|
}
|
|
else
|
|
{
|
|
return "M";
|
|
}
|
|
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|