1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
using System;
using System.Collections;
using System.ComponentModel;
using System.Text;
namespace Graphviz
{
public class StandardValuesTypeConverter : TypeConverter
{
public class Attribute : System.Attribute
{
public StandardValuesCollection Values
{
get { return _values; }
}
public Attribute(ICollection values)
{
_values = new StandardValuesCollection(values);
}
private readonly StandardValuesCollection _values;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
Attribute attribute = (Attribute)context.PropertyDescriptor.Attributes[typeof(Attribute)];
return attribute == null ? null : attribute.Values;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return false;
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return (Attribute)context.PropertyDescriptor.Attributes[typeof(Attribute)] != null;
}
}
}
|