Sunday, January 3, 2010

UITypeEditor implementation

As I continued to develop on the Designer tonight, I thought I’d re-visit an area of UI development that has always been difficult for me to grasp. The UITypeEditor and implementing custom editors for custom Types that the PropertyGrid can use. I thought about it tonight and began working on building a custom Script Editor to test out editing scripts inline from within the PropertyGrid with a custom editor. It had been over a year since I had visited this approach and I had learned a lot regarding C# over the course of the year and I was actually pretty surprised at how easily I was able to put together a custom UI editor for the propertygrid.

This opens up a whole new can of worms for me and my approach to designing the UI for the designer. Most of the UI was designed due to custom objects that couldn’t be edited from within the standard PropertyGrid due to it containing custom Types. I couldn’t edit a Rooms Doors from within the PropertyGrid as the Doors where a custom Type. The PropertyGrid couldn’t do it for me, that is until now, with my understanding how to implement a custom TypeEditor.

What’s this mean for the designer? It means I’m going to look at re-designing the editors to support it. I might be able to finally merge all of my editors into a single editor like I wanted to from the beginning. It also allows me to look into dynamically generating the GUI content as I can store the TypeEditors within the Engine itself. So that as I make changes to the engine classes, those reflections can be made immediately within the designer, just make a couple adjustments to the TypeEditors within the engine and the designer will reflect those changes.

It also opens up an easier avenue for developers to write plug-in support, and extend off existing classes with their own. They can build a TypeEditor and have instant access from within the designer to their custom Types, without having to modify the original source code.

I see quiet a bit of testing and exploring over the next couple of weeks while I take a look at this, there is some serious potential here.

No comments:

Post a Comment