August 31, 2011
Making Sitefinity 4 Control Templates Easier
One of the great things about Sitefinity 3 was that you could add a couple of attributes to your controls and have a great design experience with little to no additional effort. The steps you have to go through to get the same thing in Sitefinity 4 are, well, insane. Take a look at this...six files for what you used to be able to do in one. There had to be a better way.
What I'm sharing today is pre-alpha, but is a large step towards bringing back attribute-based design experiences.
First, download the ZIP file with the code. It contains four files: DesignerScript.ashx, DesignerScript.ashx.cs, EmptyLayout.ascx, and GenericDesigner.cs. Drop all four files in the root of your Sitefinity 4.2 or higher project and ensure they're included in the project.
Second, add the following attribute to your UserControl's class:
If you get a red squiggly on that class, add "using Telerik.Sitefinity.Web.UI.ControlDesign;" to your using clauses.
That's it. The new system respects the Browsable and DisplayName attributes, gives you checkboxes for booleans, basic validation for integer types, and if your property is a string type with "Html" in the property name, it will spit out a text area for you instead.
Lots of work still to do as you can see from the comments in the code, but this is a step in the right direction for the product.