Instructions for Sitefinity Autogenerated Designers

Ever been trying to figure out how to add instructions to those autogenerated designers without having to build custom ones?

Turns out there are a few simple ways to do this.

ContentSection Grouping

First off, you can use the ContentSection attribute to group stuff:

[Progress.Sitefinity.Renderer.Designers.Attributes.ContentSection("Advanced Settings")]

Just a nice way to keep things organized under collapsible sections.

Read-Only Property Hack

Here's the cool part - if you make a public string property with only a getter, it shows up as non-editable text:

[Progress.Sitefinity.Renderer.Designers.Attributes.ContentSection("Advanced Settings")]
public string Instructions { get; } = "What makes this cool is you can have inline instruction text.";

Super handy for adding instructions right in the UI without any extra work.

Labeling Your Instructions

You can make it even clearer by adding a DisplayName to your read-only property:

[Progress.Sitefinity.Renderer.Designers.Attributes.ContentSection("Advanced Settings")]
[DisplayName("Here's how you can use spaces")]
public string InstructionsSubText { get; } = "What makes this cool is you can have inline instruction text.";

Regular Old Description Attribute

And don't forget the standard Description attribute still works fine for adding hints under specific fields:

[Progress.Sitefinity.Renderer.Designers.Attributes.ContentSection("Advanced Settings")]
[Description("Select the maximum number of items to display in this widget.")]
public int InstructionsDescription { get; set; }

Full Example

Here's the whole thing put together:

#region Properties
public string SomeProperty { get; set; }

[Progress.Sitefinity.Renderer.Designers.Attributes.ContentSection("Advanced Settings")]
public string Instructions { get; } = "What makes this cool is you can have inline instruction text.";

[Progress.Sitefinity.Renderer.Designers.Attributes.ContentSection("Advanced Settings")]
[DisplayName("Here's how you can use spaces")]
public string InstructionsSubText { get; } = "What makes this cool is you can have inline instruction text.";

[Progress.Sitefinity.Renderer.Designers.Attributes.ContentSection("Advanced Settings")]
[Description("Select the maximum number of items to display in this widget.")]
public int InstructionsDescription { get; set; }
#endregion

Sitefinity Widget Designer with Instructions

Why This Matters

Just a few quick reasons I'm liking this approach:

  • Works with standard autogenerated designers
  • No custom coding needed
  • Instructions stay with the code where they belong
  • Content editors actually get guidance where they need it

Give it a try if you're tired of getting questions about how to use your widgets. Let me know if you've found other tricks for this - always on the lookout for simpler solutions.

Huge thanks to Christian May from AVIXA hit them up for Sitefinity Developement too!