views:

175

answers:

1

I'm creating a .net Webtest Custom Extraction Rule. I want my users to be able to select an enum value from a dropdown list in the Property Edit view in Visual Studio.

I Can manage to customize the DisplayName,Description,DefaultValues of integer/string properties without problem. However I can't manage to make ENUM values appear in the property Editor.

How can you do that?

Example :

public Enum FooBarEnum
{
   Foo,
   Bar,
   FooBar,
   BarFoo
}

public class CustomExtractionRule : ExtractionRule
{

    [DescriptionAttribute("Description...")]
    [DisplayNameAttribute("Display Name...")]
    [DefaultValue("foo")]
    public String Param1
    {
       get; set;
    }

    [DisplayNameAttribute("Display Name...")]
    //[  how do I Make it appear as a  drop down list!!]
    public FooBarEnum Param2
    {
       get; set;
    }


    public override void Extract(object sender, ExtractionEventArgs e)
    {
        ...
    }

}

If I compile this, I will see a Param1 property in the Extraction Rule's property editor... but it won't show the enum... How can I bind it?

Thanks,

A: 

You may try to make a subclass of ObjectSelectorEditor type and pass it to [EditorAttribute] set on your property.

elder_george