This space is available to any ComponentArt employee to write about anything.

Browse by Tags

All Tags » ASP.NET AJAX » MaskedInput   (RSS)

  • 2
    Comments
    360 Views

    MaskedInput Transform Intellisense

    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 { ... [TypeConverter( typeof (MaskedInputTransformConverter))] public string Transform { get {...} set {...} } ... } The implementation of MaskedInputTransformConverter is very simple: /// <summary> /// Provides Visual Studio intellisense for Transform property. /// The list of StandardValues here corresponds to the properties of client-side ComponentArt_MaskedInput_Transforms object. /// </summary> public class MaskedInputTransformConverter : TypeConverter { public string [] StandardValues = { " empty ", " CreditCard_VisaMasterCard ", " CreditCard_AmEx ", " Telephone_NorthAmerica ", " ZipCode ", " PostalCode ", " PostalCode_Australia ", " EmailAddress " }; public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { return new StandardValuesCollection(StandardValues); } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true ; } } 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. Share this post: email it! | bookmark it! | digg it! | reddit!

    Posted by: Jovan
    Posted: Monday, October 27, 2008 7:06 AM
    Filed under: , , , , ,
    2 Comments




Blogs On This Site
Thoughts on web user interfaces and component development.
Ramblings of a web control developer.
Web.UI news and more
Next weeks guest: A dog and a baby dog!
I'm in your base, killing your dudes.
Absurdity is it's own message.
Musings of an ex Java developer
im in ur page, hackin ur codez
ComponentArt in the Community
... and the program ran happily ever after.

This Blog