New to Telerik UI for WPFStart a free 30-day trial

Caret

Class

Represents a special TextBox used to insert text in RadRichTextBox

Definition

Namespace:Telerik.Windows.Documents.UI

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

C#
public class Caret : TextBox

Inheritance: objectCaret

Constructors

Initializes a new instance of the Caret class.

C#
public Caret()

Properties

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

C#
public float CaretBaseLineOffset { get; }

Returns the current IME language.

C#
public ImeLanguage CurrentImeLanguage { get; }

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

C#
protected bool EnableAsynchronousTextInsertion { get; set; }
Property Value:

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

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

C#
public InputStates InputState { get; protected set; }

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

C#
public bool IsBlinking { get; set; }
Property Value:

true if the caret is blinking; otherwise, false.

C#
protected InputEvents LastInputEvent { get; set; }

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.

C#
protected int MinimumTextInsertedInterval { get; set; }
Property Value:

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

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

C#
public string Text { get; set; }

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

C#
public bool UsePreviousVersionOfMicrosoftIme { get; set; }

Methods

C#
protected override Size ArrangeOverride(Size arrangeBounds)
Parameters:arrangeBoundsSizeReturns:

Size

Clears the text currently in the caret.

C#
protected void ClearText()
C#
protected virtual void FinishComposition()

Hides the caret.

C#
public void Hide()
C#
protected bool IsOemKey(Key key)
Parameters:keyKeyReturns:

bool

C#
protected bool IsShift(Key key)
Parameters:keyKeyReturns:

bool

Is called when a control template is applied.

C#
public override void OnApplyTemplate()
C#
protected override void OnGotFocus(RoutedEventArgs e)
Parameters:eRoutedEventArgs
C#
protected virtual void OnImeCaretMoved(ImeCaretMovedEventArgs args)
Parameters:argsImeCaretMovedEventArgs

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

C#
protected override void OnInitialized(EventArgs e)
Parameters:eEventArgs

The RoutedEventArgs that contains the event data.

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.

C#
protected override void OnKeyDown(KeyEventArgs e)
Parameters:eKeyEventArgs

Provides data about the event.

C#
protected override void OnLostFocus(RoutedEventArgs e)
Parameters:eRoutedEventArgs

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.

C#
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters:eMouseButtonEventArgs

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

Called when the occurs.

C#
protected override void OnPreviewKeyDown(KeyEventArgs e)
Parameters:eKeyEventArgs

The event data.

C#
protected virtual void OnTextChanged()

Is called when content in this editing control changes.

C#
protected override void OnTextChanged(TextChangedEventArgs e)
Parameters:eTextChangedEventArgs

The arguments that are associated with the event.

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.

C#
protected override void OnTextInput(TextCompositionEventArgs e)
Parameters:eTextCompositionEventArgs

Provides data about the event.

C#
protected virtual void OnTextInputStart(object sender, TextCompositionEventArgs e)
Parameters:senderobjecteTextCompositionEventArgs
C#
protected virtual void OnTextInputUpdate(object sender, TextCompositionEventArgs e)
Parameters:senderobjecteTextCompositionEventArgs

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

C#
protected virtual void OnTextInserted(object sender, TextInsertedEventArgs e)
Parameters:senderobject

The sender.

eTextInsertedEventArgs

The TextInsertedEventArgs instance containing the event data.

Sets the style of the caret in the text editor.

C#
public void SetStyle(double fontSize, bool isItalic, Color caretColor)
Parameters:fontSizedouble

The font size to determine the height of the caret.

isItalicbool

A boolean indicating whether the current style is italic.

caretColorColor

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

Makes the caret visible and blinking.

C#
public void Show()

Events

C#
public event EventHandler<ImeCaretMovedEventArgs> ImeCaretMoved

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

C#
public event EventHandler<TextInsertedEventArgs> TextInserted