Прочетете на английски Редактиране

Споделяне чрез


TextBoxBase.CaretBrush Property

Definition

Gets or sets the brush that is used to paint the caret of the text box.

C#
public System.Windows.Media.Brush CaretBrush { get; set; }

Property Value

The brush that is used to paint the caret of the text box.

Examples

The following example creates a TextBox and adds the text, "This is some text." The example sets the CaretBrush and Foreground properties of a TextBox to blue.

XAML
<TextBox SelectionBrush="Red" SelectionOpacity="0.5"
         Foreground="Blue" CaretBrush="Blue">  
  This is some text.
</TextBox>

The preceding example produces output that is like the following illustration.

TextBox with CaretBrush set to blue. TextBox with CaretBrush set to blue

Applies to

Продукт Версии
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10