IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
In this example, you create a page appearance configuration that stores page settings, such as fonts and colors.
To create the configuration, you perform the following:
Create the configuration section class In the class you define the configuration properties that you need. Inherit from ConfigSection. You must use only primitive types for configuration properties. You can use NameValueCollection, but you cannot have more than one NameValueCollection property for a configuration element. To use a collection in the configuration class, you use ConfigElementDictionary. You can use complex properties with TypeConverter that serializes to a primitive type. To persist a property in the configuration file, you must add the ConfigurationProperty attribute.
IMPORTANT: The NameValueCollection must be named Parameters.
The following code creates the configuration section class:
You represent the page appearance with a collection of fonts and a color. You define a property for controlling whether the appearance is valid only for remote connection. The NameValueCollection stores collection of properties that you define in the configuration provider.
To create the configuration elements that represent the font and the color, you inherit from ConfigElement. You must create a constructor with ConfigElement parameter that is the parent element. You use IsKey to define a key for the class.
The following code creates the font and color elements:
The following code snippet registers the configuration in the Global.asax file:
After you register the configuration, Sitefinity CMS creates a file PageAppearanceConfig.config that is stored in ~/App_Data/Sitefinity/Configuration and it allows you to modify it from the backend. To do this, navigate to Administration » Settings » Advanced.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important