Add dropdown list for listing in custom component

I am creating a .net Webtest custom fetch rule. I want my users to be able to select an enumeration value from a dropdown in the Property Edit view in Visual Studio.

I can manage to tweak the DisplayName, Description, DefaultValues ​​of the integer / string properties without issue. However, I cannot get the ENUM values ​​to show up in the property editor.

How can you do this?

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 can see the Param1 property in the property editor of the extraction rule ... but it will not display the enum ... How to link it?

Thank,

+2


source to share


1 answer


You can try to subclass the ObjectSelectorEditor type and pass it to the [EditorAttribute] set in your property.



0


source







All Articles