Showing Focus when RichTextBox selected

4 posts, 0 answers
  1. Arthur Colman
    Arthur Colman avatar
    5 posts
    Member since:
    Dec 2006

    Posted 09 Sep 2011 Link to this post

    I like to have the caret shown when the RichTextBox gets the focus, i.e., when tabbing into it. I use the following approach.

    Private Sub RadRichTextBox_GotFocus(sender As Object, e As System.EventArgs) Handles RadRichTextBox.GotFocus

        Me.RadRichTextBox.Document.Insert("", RadRichTextBox.CurrentEditingStyle)

    End Sub


    While the caret size is smaller than usual it achieves my goal.

    Art Colman
    www.drybridge.com
  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 14 Sep 2011 Link to this post

    Hello Arthur,

    You can use the GotFocus event to accomplish the desired behavior by using the following code snippet:

    void radRichTextBox1_GotFocus(object sender, System.EventArgs e)
    {
        this.radRichTextBox1.DocumentView.Document.Selection.Clear();
        this.radRichTextBox1.DocumentView.Document.CaretPosition.MoveToFirstPositionInDocument();
        this.radRichTextBox1.DocumentView.Caret.Show();
    }

     

    Kind regards,
    Svett
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Pablo
    Pablo avatar
    7 posts
    Member since:
    May 2013

    Posted 10 May 2013 Link to this post

    I don't see a DocumentView" property in my RadRichTextbox, am I missing a namespace?
    I'm using silverlight but the way
  5. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 13 May 2013 Link to this post

    Hi Pablo,

    This forum concerns RadControls for WinForms, not RadControls for Silverlight. Please address your question in the appropriate forum in order to get adequate assistance: http://www.telerik.com/community/forums/silverlight/charting-kit.aspx.
     

    All the best,
    Stefan
    the Telerik team
    RadChart for WinForms is obsolete. Now what?
Back to Top