Breaking Paragraph in two

2 posts, 1 answers
  1. Stanescu Mihai
    Stanescu Mihai avatar
    33 posts
    Member since:
    Aug 2009

    Posted 16 May 2011 Link to this post

    Hello,

          I would like to break a paragraph in two, for starters I have tried using Commands.InsertLineBreakCommand but it doesn't work.
          I have found though that I can achive this by doing:
    private void InsertNewParagraph_Click(object sender, RoutedEventArgs e)
           {
               this.richTextBox.Document.Insert(" " + Environment.NewLine, new Telerik.Windows.Documents.Model.Styles.StyleDefinition());
               this.richTextBox.UpdateEditorLayout();
               this.richTextBox.Focus();
           }

    My question is, isn't there a specific command which I can bind to the button command?
  2. Answer
    Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 19 May 2011 Link to this post

    Hi Stanescu Mihai,

    InsertLineBreak inserts a line break in the paragraph, but does not break the paragraph in two.
    Inserting creating a new paragraph can be done as in the code snippet you posted. There is no default command for inserting a new paragraph, but you can create a custom command, which executes the code from the snippet and bind to an instance of that command. Here is forum post we discuss a possible approach to creating custom command:
    http://www.telerik.com/community/forums/silverlight/richtextbox/custom-command.aspx
    I hope that helps.

    All the best,
    Iva
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top