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

Text Alignment

1 Answer 277 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Scott Michetti
Top achievements
Rank 1
Scott Michetti asked on 05 Dec 2013, 08:20 PM
Hello, I'm using the RichTextBox and cannot get the alignment to work. Here's my code:
radRichTextBox.Insert("Sample Text");
radRichTextBox.ChangeTextAlignment(Telerik.Windows.Documents.Layout.RadTextAlignment.Center);

I would like "Sample Text" to be center aligned but it doesn't work. When adding the control I select the "Text Box or Rich Text Box" option and all the defaults after that. If I select "Word Processor", the alignment code works. Does alignment only work when selecting "Word Processor"? Maybe there's a property I need to add to get the alignment to work when selecting "Text Box or Rich Text Box".

Thanks,
Scott

1 Answer, 1 is accepted

Sort by
0
Svetoslav
Telerik team
answered on 10 Dec 2013, 03:39 PM
Hi Scott,

By default  when you use the "Text Box or Rich Text Box" wizard,  the created control is with LayoutMode=Flow and automatically set property  HorizontalAlignment=Left. The latter property is what causes the issue on your side and I'd suggest removing it from the automatically generated code. We will make sure to fix that on our side as well.

I hope this helps! Don't hesitate to contact us again!

Regards,
Svetoslav
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
Scott Michetti
Top achievements
Rank 1
Answers by
Svetoslav
Telerik team
Share this question
or