using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WpfStudy2018
{
/// <summary>
/// 将string类型转成Human
/// </summary>
public class StringToHumanTypeConverter:TypeConverter
{
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
Human h = new Human();
h.Name = value.ToString();
return h;
}
return base.ConvertFrom(context, culture, value);
}
}
}