This is a migrated thread and some comments may be shown as answers.

RichTextEditor Ribbon translation behavior

3 Answers 76 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Ralf
Top achievements
Rank 1
Ralf asked on 30 Jun 2015, 12:39 PM

Hello Telerik,

I tried to translate the control into german.

How can I prevent the behavior, which is shown in the picture. (Wordwrap and cut off).

 

Greetings

 

PS: Yes, we used also font scaling.

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 01 Jul 2015, 02:15 PM
Hello Ralf,

Thank you for writing.

What is the behavior you expect? If you turn off WordWrap, you will see just the initial part of the string? Alternatively if you increase the button width, you will have very wide buttons?

I am looking forward to your reply.

Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ralf
Top achievements
Rank 1
answered on 01 Jul 2015, 02:52 PM

Hello Telerik, 

how can i set Wordwrap or Size of buttons from the table tab? It is generated dynamically when the focus is inside a table!

Regards

Ralf

0
Stefan
Telerik team
answered on 02 Jul 2015, 09:56 AM
Hello Ralf,

The structure of RadRibbonBar is as follows: RibbonTabs contain RadRibbonBarGroups, and RadRibbonBarGroups contain either the buttons (or other elements) or RadRibbonBarButtonGroup with contains the buttons (or other elements). So you need to iterate this structure to get the desired buttons.

As the mentioned tabs are created dynamically, you can use the CommandTabSelected event of the control which will get triggered when a tab is selected. In it, we will have to verify whether table is currently clicked and from there which tab is selected. Here is how to do this for the Layout tab when a table is clicked:
void richTextEditorRibbonBar1_CommandTabSelected(object sender, CommandTabEventArgs args)
{
    if (IsTableClicked() && args.CommandTab.Text == "Layout")
    {
        foreach (RadRibbonBarGroup group in args.CommandTab.Items)
        {
            foreach (RadElement element in group.Items)
            {
                if (element is RadButtonElement)
                {
                    Console.WriteLine(((RadButtonElement)element).Text);
                    //((RadButtonElement)element).TextWrap
                    //((RadButtonElement)element).MinSize
                    //((RadButtonElement)element).MaxSize
                }
                else if (element is RadRibbonBarButtonGroup)
                {
                    foreach (RadElement innerElement in ((RadRibbonBarButtonGroup)element).Items)
                    {
                        //same approach as above
                    }
                }
            }
        }
    }
}
 
private bool IsTableClicked()
{
    Telerik.WinForms.Documents.Layout.ParagraphLayoutBox pb = null;
    if (this.radRichTextEditor1.Document.Selection.IsEmpty)
    {
        pb = this.radRichTextEditor1.Document.CaretPosition.GetCurrentParagraphBox();
    }
    else
    {
        pb = this.radRichTextEditor1.Document.Selection.Ranges.First.StartPosition.GetCurrentParagraphBox();
    }
 
    if (pb == null)
    {
        return false;
    }
 
    TableCell cell = pb.AssociatedParagraph.Parent as TableCell;
    return cell != null;
}

I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
RichTextEditor
Asked by
Ralf
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Ralf
Top achievements
Rank 1
Share this question
or