CaretBrush

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the Brush that describes the text insertion cursor for a PasswordBox or TextBox.

<object CaretBrush="colorString"  .../>
-or-
<object>
  <object.CaretBrush>
    singleBrush
  </object.CaretBrush>
</object>
value = object.CaretBrush
object.CaretBrush = value

XAML Values

Value

Description

colorString

The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. For more information, see the "colorString Grammar" section in Color.

singleBrush

Within opening and closing property elements for object.CaretBrush, exactly one object element for an object that derives from Brush. The object element can be one of the following: LinearGradientBrush, RadialGradientBrush, ImageBrush, SolidColorBrush, or VideoBrush.

Property Value

Type: Brush

The brush that is used to fill the text insertion cursor.

This property is read/write. The default value is null.

Remarks

For purposes of rendering, the null default value for CaretBrush evaluates as a black brush.

You typically use a solid color for a CaretBrush, instead of a more visually complex brush.

The purpose of a separate CaretBrush property is so that you can change the text insertion cursor color. If you have set the Background to a dark color, the default text insertion cursor may be hard for users to see.

Applies To

PasswordBox; TextBox

Version Information

Silverlight version 3

See Also

Reference