New to Telerik UI for WinForms? Download free 30-day trial

Content Controls (Structured Document Tags)

Structured Document Tags (SDT) enable users to add specific semantics to a part of the document: restricting input, binding to data source, modifying editing behavior etc.

Currently, RadRichTextEditor can import and export content controls from and to Office Open XML (docx) and XAML formats. When exporting to other formats the content controls will be lost, however, their content (current value) will be exported.

Content controls inside the document

The contented controls can be defined on Block, Inline, Row or Cell level. The content controls can contain other content controls as well. In addition, one can modify the editing behavior of the content controls. This means that you can lock the content of the content control, the entire content control or both.

Supported content controls

  • Bibliography
  • CheckBox
  • Citation
  • ComboBox
  • Date
  • DocumentPart
  • DocumentPartGallery
  • DropDownList
  • Equation
  • Group
  • Picture
  • RichText
  • Text
  • RepeatingSection
  • RepeatingSectionItem

The following content controls are not supported by Microsoft Word:

  • Bibliography
  • Equation

Common content controls properties

The above content controls share the following properties:

  • Type: Gets the type of the current content control.
  • ID: Gets or sets the ID of the associated SDT. Each content control must have an unique ID.
  • DataBinding: Gets or sets an XML mapping (DataBinding) that relates the content of associated SDT to a specific XML node.
  • Lock: This property controls if the entire content control or its contents can be edited or deleted. The possible values are:
    • Unlocked: The content control can be edited and deleted.
    • SdtLocked: The content control can be edited but cannot be deleted.
    • ContentLocked: The content control cannot be edited, the entire content control can be deleted.
    • SdtContentLocked: The content control cannot be edited or deleted.
  • Alias: Gets or sets the name for the associated content control.
  • Tag Gets or sets a tag for the associated SDT.
  • IsTemporary Gets or sets a value that indicates whether this SDT will be removed after editing its content.
  • OutlineColor: Gets or sets the color that is used for visualizing the outline.
  • OutlineAppearance Represents the different options for visualizing the outline of a content control.The possible values are:
    • BoundingBoxes: The content is wrapped in a bounding box that may also contain a specific editor.
    • Tags: The content is wrapped in design view tag.
    • None: The content does not have outline visualization.
  • PlaceHolder: Gets or set the associated placeholder object.
    • ShowPlaceHolder: This property enables/disables the Placeholder editing behavior.
    • PlaceholderText: This property holds the Placeholder text.

Content controls that have specific properties.

CheckBox

The CheckBox content control exposes two properties CheckedState and UnCheckedState, both properties are of type SdtCheckBoxState which allows you to set the respective character and its font. The Checked property specifies whether the checkbox is checked.

Example 1: Setting CheckBox properties

SdtCheckBoxState checkedBoxState = new SdtCheckBoxState();
checkedBoxState.Font = new Telerik.WinControls.RichTextEditor.UI.FontFamily("Arial");
checkedBoxState.CharacterCode = 0040;

SdtCheckBoxState uncheckedBoxState = new SdtCheckBoxState();
uncheckedBoxState.Font = new Telerik.WinControls.RichTextEditor.UI.FontFamily("Arial");
uncheckedBoxState.CharacterCode = 0024;

CheckBoxProperties properties = new CheckBoxProperties();
properties.CheckedState = checkedBoxState;
properties.UncheckedState = uncheckedBoxState;
properties.Checked = true;

Dim checkedBoxState = New SdtCheckBoxState()
checkedBoxState.Font = New Telerik.WinControls.RichTextEditor.UI.FontFamily("Arial")
checkedBoxState.CharacterCode = 40

Dim uncheckedBoxState = New SdtCheckBoxState()
uncheckedBoxState.Font = New Telerik.WinControls.RichTextEditor.UI.FontFamily("Arial")
uncheckedBoxState.CharacterCode = 24

Dim properties = New CheckBoxProperties()
properties.CheckedState = checkedBoxState
properties.UncheckedState = uncheckedBoxState
properties.Checked = True

ComboBox and DropDownList

The ComboBox and DropDownList provider the user with options to choose from. The only difference is that when using ComboBox you can add a value that is not in the data source.

  • Items: Allows you to specify the predefined items.
  • LastValue: Return the currently selected value.
  • SelectedItem: Holds the currently selected item object. It offers the following properties:
    • DisplayText: Holds the displayed in the ComboBox/DropdownList text.
    • Value: Holds the value, which can be propagated through a data-binding relation.

Example 2: Setting ComboBox properties

List<ListItem> items = new List<ListItem>();
items.Add(new ListItem() { DisplayText = "Choice 1", Value = "a" });
items.Add(new ListItem() { DisplayText = "Choice 2", Value = "b" });

ComboBoxProperties properties = new ComboBoxProperties();
properties.Items = items;
properties.SelectedItem = items.Where(li => li.Value == "a").FirstOrDefault();

Dim items As List(Of ListItem) = New List(Of ListItem)()
items.Add(New ListItem() With {
    .DisplayText = "Choice 1",
    .Value = "a"
})
items.Add(New ListItem() With {
    .DisplayText = "Choice 2",
    .Value = "b"
})

Date

The Date content control allows you to enter a date by using a calendar. The date content control has the following properties:

  • DateFormat: Gets or sets the format string of the date. If it is omitted the default date format for the language is used.
  • Language: Gets or sets the CultureInfo object for the date format.
  • FullDate: Gets or sets the date time content.
  • Calendar: Gets or sets the type of calendar that is used for displaying the content.
  • DateMappingType Gets or sets the data type (e.g. Date, DateTime, and Text) that is used for storing mapped date time value.

Example 3: Setting Date properties

DateProperties properties = new DateProperties();
properties.DateFormat = "MM/dd/yyyy H:mm";
properties.Language = new CultureInfo("bg-BG");
properties.FullDate = DateTime.Now;
properties.Calendar = SdtCalendar.Gregorian;
properties.DateMappingType = DateMappingType.DateTime;

Dim properties As DateProperties = New DateProperties()
properties.DateFormat = "MM/dd/yyyy H:mm"
properties.Language = New CultureInfo("bg-BG")
properties.FullDate = DateTime.Now
properties.Calendar = SdtCalendar.Gregorian
properties.DateMappingType = DateMappingType.DateTime

Text

The Text content control allows you to enter plain text. The text content control has the following property:

  • IsMultiline: Gets or sets a value that indicates whether the SDT supports new lines in its content.

Example 4: Setting Text properties

TextProperties properties = new TextProperties();
properties.IsMultiline = true;

Dim properties As TextProperties = New TextProperties()
properties.IsMultiline = True

RepeatingSection

The RepeatingSection content control repeats the content contained within it. The repeating section content control has the following properties:

  • SectionTitle: Gets or sets the title of the section.
  • AllowInsertAndDeleteSections: Gets or sets a value that indicates whether the underlying sections can be modified.

Example 5: Setting RepeatingSection properties

RepeatingSectionProperties properties = new RepeatingSectionProperties();
properties.SectionTitle = "Title";
properties.AllowInsertAndDeleteSections = true;

Dim properties As RepeatingSectionProperties = New RepeatingSectionProperties()
properties.SectionTitle = "Title"
properties.AllowInsertAndDeleteSections = True

See Also

In this article
Not finding the help you need? Improve this article