WPF 4で追加されるSilverlightにのみ存在していた機能 - 「CaretBrush、SelectionBackground、SelectionForeground」

Caret Brush – WPF Text Blog



Silverlight 2のTextBoxとPasswordBoxでは、SelectionBackgroundプロパティで選択されている文字列の背景色を、SelectionForegroundプロパティで選択されている文字列の色を設定することができます。


また、Silverlight 3のTextBoxとPasswordBoxでは、CaretBrushプロパティでカレット(文字列の挿入場所を示す縦棒)の色を設定することができます。


XAML

        <TextBox CaretBrush="Red"
                SelectionBackground="Green"
                SelectionForeground="Yellow"/>





WPF 3.5ではこれらのプロパティが存在しませんが、WPF 4のTextBox、RichTextBox、PasswordBoxではCaretBrushプロパティが追加されるようです。なお、上記の記事の文章中にはSelectionBackgroundプロパティとSelectionForegroundプロパティがありませんが、スクリーンショットの画像では選択された文字列の背景色が変更されているので、おそらくこれらのプロパティも追加されると思われます。

How to change highlighting color of textbox control?
this is a feature that we will consider for future releases. Thanks for the feedback


Selection Color of a TextBox
currently this scenario is not supported. We are looking at this for future releases.