Checkbox list as property type which is created dynamically at runtime

hi,

i have two classes in my designer: A and B.
In my diagram there is A1 a instance of class A and B1, B2 and B3 who are instances of class B.
A1 should have a property whose type is a checkbox list and the checkbox list items should be B1, B2, B3. So the items of the checkboxlist should be filled with name of the instances of class B that exist in the diagram.
Is there a checkbox list type for a class property I know that there is the enum type, but this wont solve my problem since the enums are not created at runtime and you can only select one item. Or is it possible to select servel items of a enum property
Any other ideas, how i can select some instances of a certain class and save this as a property value of an other instance

Thanks,
Benjamin


Answer this question

Checkbox list as property type which is created dynamically at runtime

  • Busy Dragon

    Benjamin,

    If you just wanted a dynamic, single-select list, you could this with a TypeConverter - see http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=71541&SiteID=1 for some sample code.

    If you want a dynamic, multi-select list, you can this by implementing a custom UITypeEditor. This would allow you define a custom UI such as a checked listbox and dynamically populate it. There have been a several postings on this subject - search in this forum for "UITypeEditor".

    Writing a UITypeEditor would give you a way of providing a custom UI to the user, but you would have to decide how to store the data. You could just encode the values into a single string value on Class A, or you could be more adventurous and try some of the suggestions Gareth made in this thread: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=61508&SiteID=1.

    I don't think enums help you for the reasons you give.

    Duncan


  • TRB

    Duncan,

    thanks a lot. Very helpful, as always!
    This was exactly what i was looking for!

    Benjamin

  • Checkbox list as property type which is created dynamically at runtime