The class should always inherit from DefinitionConfigElement and implement the interface for your custom definition. As each custom configuration class, it should provide a constructor which takes the parent configuration class as a parameter.
The difference between a configuration element used in definitions and a normal one, is that it implements the GetDefinition method of the base class DefinitionConfigElement. In the implementation, you should return an instance of the definition class implemented in the previous step, which corresponds to the custom config element. You can create a new instance and pass this as an argument (this is why the definition class has such a constructor).
The only thing left is to implement the definition interface and all properties it contains. Those properties should be implemented as normal configuration properties. This will let Sitefinity CMS generate user interface to edit them, as well as work with them through the configuration API.
"Custom header text"
, Name =
, Description =
"Specifies arbitrary text in the header of the control"
] = value;
As you can see, configuration properties should be marked with an attribute and store/retrieve values from the dictionary that each configuration element implements. The key used in the getter and setter should always be the same, and the name used in the ConfigurationElement attribute should be the same as that key. Those three values are highlighted in the above code snippet.
Another attribute which is not required is the ObjectInfo attribute. We advise that you include that to let Sitefinity CMS know what text it should use in the user interface generated for the configuration class. You can specify the title and description that users will see in the UI. Those values will be used in the Advanced settings screen. Please take a look at the screenshot below on how they are used.
After you have implemented all properties from the definition interface as configuration properties, you can use your custom definition in your custom widgets.
Back To Top
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.