StrataFrame Forum

Property Editor much like RequiredFields

http://forum.strataframe.net/Topic27609.aspx

By Keith Chisarik - 7/5/2010

I have the need to implement some business object level collections. Can someone point me in the right direction as to how to go about implementing these with the editor like the RequiredFields collection has?

I have them working as just a string collection, but it would be very nice to have the nice UI as these will be often used.

I started to poke around in the source code and it looked manageable at a glance, then I hit the line "to interface with Strataframe's VS entensibility" in the source and figured I would stop and ask how big of a deal what I am trying to do is before I get in too deep.

I want to do exactly what the RequiredFields collection does, present all fields and then allow fields to be selected (added to the collection), each collection will mean something different about those fields.

By Greg McGuffey - 7/6/2010

Keith, I'm looking into this. This is all doable, but maybe not trivial. It is VS extensibility stuff. It is pretty easy if you have a collection and will just add items to the collection, in which case, VS will just handle it. But you want to show a list of existing items, with a checkboxes next to them. This is custom stuff, i.e. you'll have to build a form to show this and then setup it up to be a Modal Type editor. Typically, this is done via the following steps:



1. Build a class that inherites UITypeEditor. This class gets called by the designer and will open a dialog you build. The current value (collection in this case) gets passed in, you manipulate it via the dialog, then return the modified version.

2. Build a dialog to show the collection. I'm not sure how you get the list of possible items, which comes from the BO...but it must be possible! Hehe

3. Add an attribute to the property of the BO to indicate is should use the type editor created in one.





Hopefully this will get you started. When I get a moment, I'll do some more digging.
By Greg McGuffey - 7/6/2010

Ah...brilliant...attribute barfed cause I forgot to use html codes...



<Editor(GetType(CustomUIEditor)), GetType(UITypeEditor))>




where CustomUIEditor is the class built in step 1.