Adding Shapes to Document editor

1 Answer 164 Views
RibbonView and RibbonWindow RichTextBox
Jacob
Top achievements
Rank 1
Jacob asked on 07 Apr 2022, 06:29 PM

Hi,

In our project we have a document editor that borrows from the code of the telerik editor found here: https://github.com/telerik/xaml-sdk/blob/master/RichTextBox/TelerikEditor/TelerikEditor.xaml. After the release allowing shapes to be added we have been receiving requests to add the ability for the use to input shapes using the our editor in the same way it is shown here: https://docs.telerik.com/devtools/wpf/controls/radrichtextbox/features/shapes/shapes. After a lot of searching through forums and the documentation on shapes I have found no way to implement this feature. Could someone advise me on how to add the shapes dropdown to the ribbon of the editor, and whether or not that is all the code I will need to allow a user to add/manipulate the predefined shapes? The documentation says that "In the Insert tab, you will find a list containing various predefined shapes you can choose between". I haven't found a way to add this to our editor or even where it resides in the telerik editor. Any help would be greatly appreciated.

1 Answer, 1 is accepted

Sort by
1
Accepted
Dimitar
Telerik team
answered on 08 Apr 2022, 10:11 AM

Hello Jacob,

Although it is in our roadmap to update such examples this one is still not updated. The easiest approach for this is to create a new blank project with the latest version, add a RichTextBox ribbon to the Windows, and get its XAML. You can update the entire XAML or just parts of it and add it to your actual project. I believe it would be better to get the whole xaml since the shapes functionality adds a new tab and some dialogs that allow you to interact with the shapes. I have attached such a project for your reference. 

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Jacob
Top achievements
Rank 1
commented on 08 Apr 2022, 02:02 PM

Using the example you gave me, I was able to paste in the necessary XAML, and only needed to change a couple things to get this working. For anyone who finds this question and is trying to do the same thing in the future, you will likely need to change the radRichTextBox binding on all the XAML related to shapes (one example: <telerik:ShapesGallery AssociatedRichTextBox="{Binding ElementName=radRichTextBox}"/>) to match the name of your ruler (ours was named MessageRichTextBox) after doing this you should be able to draw shapes and manipulate them. Thank you for your prompt answer and the sample you sent. It was exactly what I needed to get this feature working.
Dimitar
Telerik team
commented on 11 Apr 2022, 07:26 AM

Hi Jacob, 

I am glad that this works and thank you for your feedback. Do not hesitate to contact us if you have other questions.

Tags
RibbonView and RibbonWindow RichTextBox
Asked by
Jacob
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or