CuteEditor for .NET

Inline Style Dropdown Customization

Inline Style Dropdown Customization


The Inline Style dropdown of CuteEditor displays a predefined set of Inline Styles. You can easily add your own Inline Styles using the following methods:
 

1: Edit Dropdown Configuration file (Common.config):

The dropdown configuration file (Common.config) can be found in the /CuteEditor/Configuration/Shared folder. In dropdown configuration file you can find the CssStyle element which contains the configuration information for the Inline Style dropdown within CuteEditor.  

You can modify the CssStyle element to create your own Inline Styles list.

 

Example:


<CssStyle>
    
<item text="[[NotSet]]" value="null"></item>
    
<item text="font-size:18pt" value="font-size:18pt"></item>
    
<item text="color:red" value="color:red"></item>
    
<item text="border:1px red solid" value="border:1px red solid"></item>
</CssStyle>

 

Now the Inline Style dropdown contains "font-size:18pt", "color:red" and "border:1px red solid".


 

 


2: Programmatically populate the Inline Style dropdown:

C# Example:

if (!IsPostBack) { 
CuteEditor.ToolControl toolctrl=Editor1.ToolControls["CssStyle"];
if(toolctrl!=null) {
CuteEditor.RichDropDownList dropdown=(CuteEditor.RichDropDownList)toolctrl.Control;
//the first item is the caption
CuteEditor.RichListItem richitem=dropdown.Items[0];
//clear the items from configuration files
dropdown.Items.Clear();
//add the caption
dropdown.Items.Add(richitem);
//add value only
dropdown.Items.Add("font-size:18pt");
//add text and value
dropdown.Items.Add("color:red","color:red");
//add html and text and value
dropdown.Items.Add("<span style='border:1px red solid'>border:1px redsolid</span>","border:1px red solid","border:1px red solid");
}
}


VB Example:

If Not Page.IsPostBack Then
  If Not Editor1.ToolControls("CssStyle") Is Nothing Then

      Dim dropdown As CuteEditor.RichDropDownList
      Dim richitem As CuteEditor.RichListItem

      dropdown = DirectCast(Editor1.ToolControls("CssStyle").Control, CuteEditor.RichDropDownList)

      'the first item is the caption
      richitem = dropdown.Items(0)

      'clear the items from configuration files
      dropdown.Items.Clear()

      'add the caption
      dropdown.Items.Add(richitem)

      'add value only
      dropdown.Items.Add("font-size:18pt")

     'add text and value
      dropdown.Items.Add("color:red","color:red")

      'Add html and text and value
      dropdown.Items.Add("<span style='border:1px red solid'>border:1px red solid</span>", "border:1px red solid", "border:1px red solid")

  End If
End If