MaskedInput class's Transform property that I described in depth in a few preceding blog posts presented us with an interesting design dilemma. At first it seemed like it should be a typical enumeration property, with one value for each Transform type. However, since the architecture allowed new Transform types to be added in a number of different ways (see the previous blog posts), the enum turned out to be too stifling. For that reason, we opted for a string instead.
However, we still wanted to offer some Intellisense, to give the developer a hint at the values he would most likely want to use. We did it by placing the TypeConverterAttribute on the Transform property:
public sealed class MaskedInput : BaseInput
public string Transform
The implementation of MaskedInputTransformConverter is very simple:
/// Provides Visual Studio intellisense for Transform property.
/// The list of StandardValues here corresponds to the properties of client-side ComponentArt_MaskedInput_Transforms object.
public class MaskedInputTransformConverter : TypeConverter
public string StandardValues =
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
return new StandardValuesCollection(StandardValues);
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
This works really well in ASPX Intellisense, popping up the list of standard values, without forcing you to use one of them - exactly the behaviour we needed. The Intellisense also works for the Properties pane. Unfortunately it does not work in the CodeBehind files, and I don’t think there is a way to implement it there.