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

Showing Focus when RichTextBox selected

3 Answers 90 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Arthur Colman
Top achievements
Rank 1
Arthur Colman asked on 09 Sep 2011, 09:59 PM

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

3 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 14 Sep 2011, 04:15 PM
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 >>
0
Pablo
Top achievements
Rank 1
answered on 10 May 2013, 09:40 PM
I don't see a DocumentView" property in my RadRichTextbox, am I missing a namespace?
I'm using silverlight but the way
0
Stefan
Telerik team
answered on 13 May 2013, 06:08 AM
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?
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Arthur Colman
Top achievements
Rank 1
Answers by
Svett
Telerik team
Pablo
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or