This topic explains how the predefined UI of RadRichTextBox - RadRichTextBoxRibbonUI - can be used.
RadRichTextBoxRibbonUI is a ribbon control that has been wired to work with the commands that RadRichTextBox exposes.
RadRichTextBoxRibbonUI can be found in the Toolbox of Visual Studio, if you have installed the controls automatically.
If you have not installed Telerik UI automatically or the dlls you use are using are placed in another folder, you have to manually add the RadRichTextBoxRibbonUI to the Toolbox. Here are the steps you have to follow in order to do this: 1. Add references to the following DLLs in your project:
Telerik.Windows.Controls.RichTextBoxUI 2. Drag Telerik.Windows.Controls.RichTextBoxUI.dll to your toolbox. Ensure that Telerik.Windows.Controls.RichTextBoxUI.VisualStudio.Design.dll assembly is in the same directory as Telerik.Windows.Controls.RichTextBoxUI.dll, so the Visual Studio can load it (actually it could be placed one level deeper in a subfolder named Design). Now you should be able to drag the RadRichTextBoxRibbonUI from the toolbox to the design surface.
In order to use it, you have to open the desired UserControl and choose Designer View. Drag an instance of the RadRichTextBoxRibbonUI in the designer area and drop it. Wait for a few seconds. After that all the XAML will be generated automatically and you will get a fully functional and fully customizable UI for your RadRichTextBox.
The generated UI will automatically get attached to the first RadRichTextBox control inside the UserControl.
If you take a closer look at the generated code there are a few things that must be mentioned:
The UI is represented by a RadRibbonView control. You can freely add, remove or modify the elements in it.
To associate the UI with the RadRichTextBox, the latter one is passed as DataContext of the RadRichTextBoxRibbonUI.
The functional elements (buttons, etc) have their RadRichTextBoxRibbonUI.RichTextCommand property bound to a command exposed by the RadRichTextBox, which, as mentioned above, is set as DataContext of the RadRichTextBoxRibbonUI.
You can take a look at the XAML that is generated by following the steps in this topic in the Telerik Editor SDK example.
To learn more about the commands exposed by the RadRichTextBox and how to use them read here.
By knowing that the UI is connected to the RadRichTextBox via its DataContext, you can easily implement a scenario where you have more than one RadRichTextBox controls ruled by one UI. You just have to change the DataContext of the UI depending on which RadRichTextBox is active.