Text styles

When editing text in the web site, the editor can choose from predefined text styles, like Heading 1, Heading 2, Normal or Introduction. These text styles are defined using single-instance objects inheriting from Dynamix.TextStyle.

Adding text styles

Create a new item in the solution using the template Dynamix 6 - Text style:

Edit the .dx6-file and use the Details tab to set a name for the text style. This name will be displayed in the editing toolbar.

Implement Tag and ClassName In the code file .dx6.cs

// This is the css class that will be added to the tag
public override string ClassName
{
    get { return "Headline1"; }
}

public override TextStyleTag Tag
{
    get { return TextStyleTag.H1; }
}

Installing the new text style in the solution

You can add the text style with code, either from a Runnable, an Upgrade or a stand alone page.

Dynamix.Storage.Install<Headline1>();

You can also install the text style manually from the Dynamix UI using the tool Components found in Tools/Administration:

Click the Text styles-item

The list to the right shows the currently installed text styles

Click Install

Check the style or styles you want to install and click Ok.

Allowing text styles in sections

There are often many text styles in a site or web solution. Some are only useful in specific places, like the page footer or in specific templates. Because of this you have to specify which sections that allow each text style. You can do this from code when the template is defined.

You can also add allowed text styles using the Dynamix UI. When editing a page - right click in the section and choose Edit Section:

Choose which text styles to allow and click Ok.

Last updated 2016-01-14