Skip to content

Add configurable CaretWidth property to Caret class - #605

Open
xlievo wants to merge 1 commit into
AvaloniaUI:masterfrom
xlievo:master
Open

Add configurable CaretWidth property to Caret class#605
xlievo wants to merge 1 commit into
AvaloniaUI:masterfrom
xlievo:master

Conversation

@xlievo

@xlievo xlievo commented Jul 7, 2026

Copy link
Copy Markdown

Description

Adds a public CaretWidth property to Caret, replacing the hardcoded private const double CaretWidth = 0.5.

Motivation

The caret width is currently a private constant, making it impossible to customize without forking. This is especially problematic on high-DPI displays where the default 0.5 DIP caret is difficult to see.

Changes

  • Caret.cs: private const double CaretWidth = 0.5public double CaretWidth { get; set; } = 0.5;
  • No changes needed in CaretLayer.cs — the width is already passed through Rect via CalculateCaretRectangle().

Usage

textEditor.TextArea.Caret.CaretWidth = 1.5;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant