FlowDirection buttons API

4 Answers 50 Views
RichTextEditor
Emin Sadigov
Top achievements
Rank 2
Iron
Iron
Iron
Emin Sadigov asked on 28 Sep 2023, 02:06 PM

Hello, 

Telerik have demo Richtexteditor - Document API project example with 3 buttons (bold, italic and underline) . Can you please send me any example or project how to add there two FlowDirection buttons (LTR and RTL) with toggled states as in the first look realization?

Thank you!

4 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Sep 2023, 05:15 AM

Hello, Emin,

The mentioned example in our Demo application gives you access to the C# and VB.NET implementation and the design of the form itself:

Thus, you can use it for implementing a similar design on your end and further extend it according to the requirements you have with adding additional buttons. The RightToLeft property that RadRichTextEditor offers controls the document's RTL mode:

this.radRichTextEditor1.RightToLeft = RightToLeft.Yes;

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
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.

0
Emin Sadigov
Top achievements
Rank 2
Iron
Iron
Iron
answered on 29 Sep 2023, 09:10 AM

Hello, Dess.

 

Thank you for your reply.

 

I have planned to bind 2 buttons to event. I thought that the Commands.ChangeParagraphFlowDirectionCommand.FlowDirectionChanged must be implemented to support 2 buttons LTR and RTL. And switch between them.

I think that must exist native code from the RichTextEditorRibbonBar  - where can I find it?

0
Emin Sadigov
Top achievements
Rank 2
Iron
Iron
Iron
answered on 29 Sep 2023, 10:02 AM

Hello, please disregard my last post, I found solution in the Examples\RichTextEditor\RichTextEditorRibbonUI\RichTextEditorRibbonBar.cs file

But i have made by other way:

Added 2 ToggleState buttons pointed to ToggleStateChanged method.

In the FormLoad:

Editor.Commands.ChangeParagraphFlowDirectionCommand.FlowDirectionChanged += new EventHandler<StylePropertyChangedEventArgs<Telerik.WinControls.RichTextEditor.UI.FlowDirection?>>(Command_FlowDirectionChanged);

Then:


private void ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs e)
        {
            if (suspendToggleEvents)
                return;
            if ((sender as CommandBarToggleButton).Name.EndsWith("Bold"))
                Editor.ToggleBold();
            else if ((sender as CommandBarToggleButton).Name.EndsWith("Italic"))
                Editor.ToggleItalic();
            else if ((sender as CommandBarToggleButton).Name.EndsWith("RTL"))
                Editor.ChangeParagraphFlowDirection(Telerik.WinControls.RichTextEditor.UI.FlowDirection.RightToLeft);
            else if ((sender as CommandBarToggleButton).Name.EndsWith("LTR"))
                Editor.ChangeParagraphFlowDirection(Telerik.WinControls.RichTextEditor.UI.FlowDirection.LeftToRight);
            Editor.Focus();
        }

private void Command_FlowDirectionChanged(object sender, StylePropertyChangedEventArgs<Telerik.WinControls.RichTextEditor.UI.FlowDirection?> e)
        {
            suspendToggleEvents = true;

            if (sender.GetType().Name.Equals("ChangeParagraphFlowDirectionCommand"))
            {
                if (e.NewValue == Telerik.WinControls.RichTextEditor.UI.FlowDirection.LeftToRight)
                {
                    btn_LTR.ToggleState = ToggleState.Off;
                    btn_RTL.ToggleState = ToggleState.On;
                }
                else
                {
                    btn_LTR.ToggleState = ToggleState.On;
                    btn_RTL.ToggleState = ToggleState.Off;
                }
            }

            suspendToggleEvents = false;
        }

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 03 Oct 2023, 10:34 AM

Hi, Emin,

I am glad that you have found a suitable solution for your scenario with the help of our Demo application and RadRichTextEditor's examples.

After reviewing the code snippet, it seems OK to me. Feel free to use this approach to achieve the functionality you need to cover.

Regards,
Dess | Tech Support Engineer, Principal
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.

Tags
RichTextEditor
Asked by
Emin Sadigov
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Emin Sadigov
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or