With the latest improvements in our RichTextBox for WPF, you can add specific semantics such as restricting input, modifying editing behavior, etc. to a document. Check out how it works.
With the R2 2020 release, Telerik UI for WPF gained Content Controls for RichTextBox that enable end-users to easily add specific semantics such as restricting input, modifying editing behavior, etc. to parts of a given document. In this blog post, we will walk you through the features and functionalities of the Content Controls.
First, let us clarify an important distinction between structured document tags and content controls. Structured document tags are XML elements (tags) defined in the WordprocessingML that allow embedding customer-defined semantics as well as their behavior and appearance into a document. The visual representation (UI) of these elements we refer to as Content Controls. The Structured document tags have content and pre-defined properties, and these properties set the semantic specifics, and according to them the RadRichTextBox decides which Content Control to visualize.
For better understanding: Consider a region which should be tagged with the semantic of "birthday," for the user to enter their date of birth into the document. Ideally, this region would also utilize a date picker to allow the user to enter the date from a calendar:
This content would be specified by using Structured Document Tags properties and visualized (according to these properties) as Content Controls in the document.
Content controls are individual controls that can be used inside forms, templates and documents in order to further improve the user experience. They enable users to restrict input, modify editing behavior, etc. Content controls can be defined on Block, Inline, Row or Cell level, and can be nested inside each other. You can manipulate existing or insert new content controls.
Content controls provide a way to design documents and templates by:
When you have the RadRichTextBox control open, you can choose among the supported content control types inside the Developer Tab.
As of R2 2020 there are eight content control types that can be inserted using the user interface (UI) or the RadRichTextBox API:
RadRichTextBox supports import/export and basic operations for the following content controls as well using its API:
Content Controls expose a bunch of properties that can be modified both directly from the UI or programmatically.
PictureProperties pictureProperties = new PictureProperties();
pictureProperties.Lock = Lock.SdtContentLocked;
this.radRichTextBox.InsertSdt(pictureProperties);
this.radRichTextBox.InsertLineBreak();
DateProperties dateProperties = new DateProperties();
dateProperties.Language = new CultureInfo("bg-BG");
dateProperties.DateFormat = "dd MMMM yyyy 'г.'";
dateProperties.FullDate = new DateTime(2020, 5, 13);
this.radRichTextBox.InsertSdt(dateProperties);
Get yourself a free trial of Telerik UI for WPF today and start developing your apps better, faster and more easily.
Let’s continue to build the future of Telerik UI for WPF together! So don’t forget to share your thoughts as a comment below or let us know if you have any suggestions and/or need any features/controls by visiting our Feedback portals about UI for WPF/Silverlight and Document Processing Libraries.
Martin is a Software Engineer, part of the Document Processing team in Sofia, Bulgaria since July 2019. He is passionate about new technologies and is always on the crest of a wave with the novelties. In his spare time, Martin likes travelling to new destinations and exploring new cultures, hanging out with friends, reading books, practicing sports, and more.