skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for ASP.NET AJAX UI for ASP.NET MVC UI for ASP.NET Core UI for Blazor UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Tools
    ThemeBuilder
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class Caret

Represents a special System.Windows.Controls.TextBox used to insert text in RadRichTextBox

Inheritance
System.Object
Caret
Namespace: Telerik.Windows.Documents.UI
Assembly: Telerik.Windows.Documents.dll

Syntax

public class Caret : TextBox

Constructors

Caret()

Initializes a new instance of the Caret class.

Declaration
public Caret()

Properties

CaretBaseLineOffset

Declaration
public float CaretBaseLineOffset { get; }
Property Value
System.Single

EnableAsynchronousTextInsertion

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

Declaration
protected bool EnableAsynchronousTextInsertion { get; set; }
Property Value
System.Boolean

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

InputState

Declaration
public InputStates InputState { get; protected set; }
Property Value
InputStates

IsBlinking

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

Declaration
public bool IsBlinking { get; set; }
Property Value
System.Boolean

true if the caret is blinking; otherwise, false.

LastInputEvent

Declaration
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
protected int MinimumTextInsertedInterval { get; set; }
Property Value
System.Int32

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

ShouldPersist

Declaration
protected bool ShouldPersist { get; set; }
Property Value
System.Boolean

ShouldStartNewComposition

Declaration
protected bool ShouldStartNewComposition { get; set; }
Property Value
System.Boolean

Text

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

Declaration
public string Text { get; set; }
Property Value
System.String

Methods

ArrangeOverride(Size)

Declaration
protected override Size ArrangeOverride(Size arrangeBounds)
Parameters
System.Windows.Size arrangeBounds

Returns
System.Windows.Size

ClearText()

Clears the text currently in the caret.

Declaration
protected void ClearText()

Hide()

Hides the caret.

Declaration
public void Hide()

IsOemKey(Key)

Declaration
protected bool IsOemKey(Key key)
Parameters
System.Windows.Input.Key key

Returns
System.Boolean

IsShift(Key)

Declaration
protected bool IsShift(Key key)
Parameters
System.Windows.Input.Key key

Returns
System.Boolean

OnApplyTemplate()

Is called when a control template is applied.

Declaration
public override void OnApplyTemplate()

OnGotFocus(RoutedEventArgs)

Declaration
protected override void OnGotFocus(RoutedEventArgs e)
Parameters
System.Windows.RoutedEventArgs e

OnImeCaretMoved(ImeCaretMovedEventArgs)

Declaration
protected virtual void OnImeCaretMoved(ImeCaretMovedEventArgs args)
Parameters
ImeCaretMovedEventArgs args

OnInitialized(EventArgs)

Raises the System.Windows.FrameworkElement.Initialized event. This method is invoked whenever System.Windows.FrameworkElement.IsInitialized is set to true internally.

Declaration
protected override void OnInitialized(EventArgs e)
Parameters
System.EventArgs e

The System.Windows.RoutedEventArgs that contains the event data.

OnKeyDown(KeyEventArgs)

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

Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
System.Windows.Input.KeyEventArgs e

Provides data about the event.

OnLostFocus(RoutedEventArgs)

Declaration
protected override void OnLostFocus(RoutedEventArgs e)
Parameters
System.Windows.RoutedEventArgs e

OnMouseLeftButtonUp(MouseButtonEventArgs)

Invoked when an unhandled System.Windows.UIElement.MouseLeftButtonUp 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
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
System.Windows.Input.MouseButtonEventArgs e

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

OnPreviewKeyDown(KeyEventArgs)

Called when the System.Windows.UIElement.KeyDown occurs.

Declaration
protected override void OnPreviewKeyDown(KeyEventArgs e)
Parameters
System.Windows.Input.KeyEventArgs e

The event data.

OnTextChanged()

Declaration
protected virtual void OnTextChanged()

OnTextChanged(TextChangedEventArgs)

Is called when content in this editing control changes.

Declaration
protected override void OnTextChanged(TextChangedEventArgs e)
Parameters
System.Windows.Controls.TextChangedEventArgs e

The arguments that are associated with the System.Windows.Controls.Primitives.TextBoxBase.TextChanged event.

OnTextInput(TextCompositionEventArgs)

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

Declaration
protected override void OnTextInput(TextCompositionEventArgs e)
Parameters
System.Windows.Input.TextCompositionEventArgs e

Provides data about the event.

OnTextInputStart(Object, TextCompositionEventArgs)

Declaration
protected virtual void OnTextInputStart(object sender, TextCompositionEventArgs e)
Parameters
System.Object sender

System.Windows.Input.TextCompositionEventArgs e

OnTextInputUpdate(Object, TextCompositionEventArgs)

Declaration
protected virtual void OnTextInputUpdate(object sender, TextCompositionEventArgs e)
Parameters
System.Object sender

System.Windows.Input.TextCompositionEventArgs e

OnTextInserted(Object, TextInsertedEventArgs)

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

Declaration
protected virtual void OnTextInserted(object sender, TextInsertedEventArgs e)
Parameters
System.Object sender

The sender.

TextInsertedEventArgs e

The TextInsertedEventArgs instance containing the event data.

SetStyle(Double, Boolean, Color)

Declaration
public void SetStyle(double fontSize, bool isItalic, Color caretColor)
Parameters
System.Double fontSize

System.Boolean isItalic

System.Windows.Media.Color caretColor

Show()

Makes the caret visible and blinking.

Declaration
public void Show()

Events

ImeCaretMoved

Declaration
public event EventHandler<ImeCaretMovedEventArgs> ImeCaretMoved
Event Type
System.EventHandler<ImeCaretMovedEventArgs>

TextInserted

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

Declaration
public event EventHandler<TextInsertedEventArgs> TextInserted
Event Type
System.EventHandler<TextInsertedEventArgs>

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)

See Also

System.Windows.Controls.TextBox

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.