Text Alignment

2 posts, 0 answers
  1. Scott Michetti
    Scott Michetti avatar
    92 posts
    Member since:
    Feb 2010

    Posted 05 Dec 2013 Link to this post

    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
  2. Svetoslav
    Admin
    Svetoslav avatar
    55 posts

    Posted 10 Dec 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top