Class
Caret

Represents a special TextBox used to insert text in RadRichTextBox

Definition

Namespace:Telerik.Windows.Documents.UI

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

cs-api-definition
public class Caret : TextBox

Inheritance: objectCaret

Constructors

Caret()

Initializes a new instance of the Caret class.

Declaration

cs-api-definition
public Caret()

Properties

CaretBaseLineOffset

Represents the base line offset of the caret in the UI component.

Declaration

cs-api-definition
public float CaretBaseLineOffset { get; }

Property Value

float

CurrentImeLanguage

Returns the current IME language.

Declaration

cs-api-definition
public ImeLanguage CurrentImeLanguage { get; }

Property Value

ImeLanguage

EnableAsynchronousTextInsertion

Gets or sets a value indicating whether asynchronous text insertion is enabled.

Declaration

cs-api-definition
protected bool EnableAsynchronousTextInsertion { get; set; }

Property Value

bool

true if asynchronous text insertion is enabled; otherwise, false.

InputState

Represents the state of the input caret within a document, providing information about its position and behavior during text editing operations.

Declaration

cs-api-definition
public InputStates InputState { get; protected set; }

Property Value

InputStates

IsBlinking

Gets or sets a value indicating whether the caret is blinking.

Declaration

cs-api-definition
public bool IsBlinking { get; set; }

Property Value

bool

true if the caret is blinking; otherwise, false.

LastInputEvent

Declaration

cs-api-definition
protected InputEvents LastInputEvent { get; set; }

Property Value

InputEvents

MinimumTextInsertedInterval

Gets or sets the minimum interval (in milliseconds) between two consecutive raises of TextInserted event. The value is respected only when EnableAsynchronousTextInsertion is true.

The default value is 15.

Declaration

cs-api-definition
protected int MinimumTextInsertedInterval { get; set; }

Property Value

int

The minimum interval (in milliseconds) between two consecutive raises of TextInserted event.

Text

Gets or sets the text contents of the text box, with all new lines removed.

Declaration

cs-api-definition
public string Text { get; set; }

Property Value

string

UsePreviousVersionOfMicrosoftIme

Gets or sets whether you want to use the previous version of Microsoft IME.

Declaration

cs-api-definition
public bool UsePreviousVersionOfMicrosoftIme { get; set; }

Property Value

bool

Methods

ArrangeOverride(Size)

Declaration

cs-api-definition
protected override Size ArrangeOverride(Size arrangeBounds)

Parameters

arrangeBounds

Size

Returns

Size

ClearText()

Clears the text currently in the caret.

Declaration

cs-api-definition
protected void ClearText()

FinishComposition()

Declaration

cs-api-definition
protected virtual void FinishComposition()

Hide()

Hides the caret.

Declaration

cs-api-definition
public void Hide()

IsOemKey(Key)

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Oem")]
protected bool IsOemKey(Key key)

Parameters

key

Key

Returns

bool

IsShift(Key)

Declaration

cs-api-definition
protected bool IsShift(Key key)

Parameters

key

Key

Returns

bool

OnApplyTemplate()

Is called when a control template is applied.

Declaration

cs-api-definition
public override void OnApplyTemplate()

OnGotFocus(RoutedEventArgs)

Declaration

cs-api-definition
protected override void OnGotFocus(RoutedEventArgs e)

Parameters

e

RoutedEventArgs

OnImeCaretMoved(ImeCaretMovedEventArgs)

Declaration

cs-api-definition
protected virtual void OnImeCaretMoved(ImeCaretMovedEventArgs args)

Parameters

args

ImeCaretMovedEventArgs

OnInitialized(EventArgs)

Raises the event. This method is invoked whenever is set to true internally.

Declaration

cs-api-definition
protected override void OnInitialized(EventArgs e)

Parameters

e

EventArgs

The RoutedEventArgs that contains the event data.

OnKeyDown(KeyEventArgs)

Invoked whenever an unhandled attached routed event reaches an element derived from this class in its route. Implement this method to add class handling for this event.

Declaration

cs-api-definition
protected override void OnKeyDown(KeyEventArgs e)

Parameters

e

KeyEventArgs

Provides data about the event.

OnLostFocus(RoutedEventArgs)

Declaration

cs-api-definition
protected override void OnLostFocus(RoutedEventArgs e)

Parameters

e

RoutedEventArgs

OnMouseLeftButtonUp(MouseButtonEventArgs)

Invoked when an unhandled  routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

Declaration

cs-api-definition
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)

Parameters

e

MouseButtonEventArgs

The MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was released.

OnPreviewKeyDown(KeyEventArgs)

Called when the occurs.

Declaration

cs-api-definition
protected override void OnPreviewKeyDown(KeyEventArgs e)

Parameters

e

KeyEventArgs

The event data.

OnTextChanged()

Declaration

cs-api-definition
protected virtual void OnTextChanged()

OnTextChanged(TextChangedEventArgs)

Is called when content in this editing control changes.

Declaration

cs-api-definition
protected override void OnTextChanged(TextChangedEventArgs e)

Parameters

e

TextChangedEventArgs

The arguments that are associated with the event.

OnTextInput(TextCompositionEventArgs)

Invoked whenever an unhandled attached routed event reaches an element derived from this class in its route. Implement this method to add class handling for this event.

Declaration

cs-api-definition
protected override void OnTextInput(TextCompositionEventArgs e)

Parameters

e

TextCompositionEventArgs

Provides data about the event.

OnTextInputStart(object, TextCompositionEventArgs)

Declaration

cs-api-definition
protected virtual void OnTextInputStart(object sender, TextCompositionEventArgs e)

Parameters

sender

object

e

TextCompositionEventArgs

OnTextInputUpdate(object, TextCompositionEventArgs)

Declaration

cs-api-definition
protected virtual void OnTextInputUpdate(object sender, TextCompositionEventArgs e)

Parameters

sender

object

e

TextCompositionEventArgs

OnTextInserted(object, TextInsertedEventArgs)

Called when text is inserted in the caret, but not often than MinimumTextInsertedInterval.

Declaration

cs-api-definition
protected virtual void OnTextInserted(object sender, TextInsertedEventArgs e)

Parameters

sender

object

The sender.

e

TextInsertedEventArgs

The TextInsertedEventArgs instance containing the event data.

SetStyle(double, bool, Color)

Sets the style of the caret in the text editor.

Declaration

cs-api-definition
public void SetStyle(double fontSize, bool isItalic, Color caretColor)

Parameters

fontSize

double

The font size to determine the height of the caret.

isItalic

bool

A boolean indicating whether the current style is italic.

caretColor

Color

The color of the caret, specified as a Color object.

Show()

Makes the caret visible and blinking.

Declaration

cs-api-definition
public void Show()

Events

ImeCaretMoved

Declaration

cs-api-definition
public event EventHandler<ImeCaretMovedEventArgs> ImeCaretMoved

Event Value

EventHandler<ImeCaretMovedEventArgs>

TextInserted

Occurs when text is inserted in the caret, but not more often than MinimumTextInsertedInterval.

Declaration

cs-api-definition
public event EventHandler<TextInsertedEventArgs> TextInserted

Event Value

EventHandler<TextInsertedEventArgs>