CuteEditor for .NET

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:


  1. <CssStyle>  
  2.    <item text="[[NotSet]]" value="null"></item>  
  3.    <item text="font-size:18pt" value="font-size:18pt"></item>  
  4.    <item text="color:red" value="color:red"></item>  
  5.    <item text="border:1px red solid" value="border:1px red solid"></item>  
  6. </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:


  1. if (!IsPostBack) {    
  2.    CuteEditor.ToolControl toolctrl=Editor1.ToolControls["CssStyle"];    
  3.    if(toolctrl!=null) {    
  4.       CuteEditor.RichDropDownList dropdown=(CuteEditor.RichDropDownList)toolctrl.Control;    
  5.       //the first item is the caption    
  6.       CuteEditor.RichListItem richitem=dropdown.Items[0];    
  7.       //clear the items from configuration files    
  8.       dropdown.Items.Clear();    
  9.       //add the caption    
  10.        dropdown.Items.Add(richitem);    
  11.       //add value only    
  12.       dropdown.Items.Add("font-size:18pt");    
  13.       //add text and value    
  14.       dropdown.Items.Add("color:red","color:red");    
  15.       //add html and text and value    
  16.       dropdown.Items.Add("<span style='border:1px red solid'>border:1px red solid</span>","border:1px red solid","border:1px red solid");    
  17.    }    
  18. }  

VB Example:

  1. If Not Page.IsPostBack Then  
  2.   If Not Editor1.ToolControls("CssStyle"Is Nothing Then  
  3.       Dim dropdown As CuteEditor.RichDropDownList   
  4.       Dim richitem As CuteEditor.RichListItem   
  5.       dropdown = DirectCast(Editor1.ToolControls("CssStyle").Control, CuteEditor.RichDropDownList)   
  6.       'the first item is the caption   
  7.       richitem = dropdown.Items(0)   
  8.       'clear the items from configuration files   
  9.       dropdown.Items.Clear()   
  10.       'add the caption   
  11.       dropdown.Items.Add(richitem)   
  12.       'add value only   
  13.       dropdown.Items.Add("font-size:18pt")   
  14.       'add text and value   
  15.       dropdown.Items.Add("color:red","color:red")   
  16.       'Add html and text and value   
  17.       dropdown.Items.Add("<span style='border:1px red solid'>border:1px red solid</span>""border:1px red solid""border:1px red solid")   
  18.   End If  
  19. End If