views:

43

answers:

1

Here's the background of the problem.

We have our own ORM framework for development of .net applications. Now we are trying to create specialized UI objects to work tightly with the ORM. We have created an interface called IBindable which is implemented on all UI controls. We started with textbox webcontrol of asp.net. First we created TextBox class deriving from System.Web.UI.WebControls.TextBox which also implements IBindable interface.

IBindable is responsible to hold key binding information for ORM.

  1. EntityType
  2. EntityFields

EntityType is the type of buiness-object within the ORM and EntityField is particular property of the EntityType business-object to which it will bind to at run-time.

Now the actual problem is,

During the design time, we wish to populate all available business objects in the project for the textbox property EntityType within the propert-window of TextBox. After the user selects given entity type we need populate properties of selected EntityType for corresponding EntityField property.

Please note that all our business objects or Entity objects derive from EntityBase abstract class.

+1  A: 

Basically, you want to attach an Editor to your properties. In your custom TextBox, you can assign the editor to your property using the EditorAttribute:

[Editor(typeof(EntityTypeChooser), typeof(System.Drawing.Design.UITypeEditor))]
public property EntityType { ... }

Of course, you will have to implement your EntityTypeChooser: You inherit from UITypeEditor and override the EditValue method.

Examples:

Heinzi
looks promising.
this. __curious_geek