Textbox Control is an essential component in our development process. It can make the applicationProgramFacilitate text interaction with users. Two new paint effects are added to textbox in new WPF 4:Selection,CaretAnd use these two special effects to make textbox more beautiful.
By default, textbox displays the following effects: the font is black, the selection is blue, and the cursor is Black:
<TextboxBorderbrush= "Gray"Borderthickness= "3"Width= "200"Height= "30"/>
Selection brush attributes
1. Font color (Foreground) And selection color (Selectionbrush):
<TextboxBorderbrush= "Gray"Borderthickness= "3"Width= "200"Height= "30"Foreground= "Red"Selectionbrush= "Green"/>
2. Selection transparency (Selectionopacity):
<TextboxBorderbrush= "Gray"Borderthickness= "3"Width= "200"Height= "30"Foreground= "Red"Selectionbrush= "Green"Selectionopacity= "1"/>
3. Gradient selection effect:
< Textbox Borderbrush = "Gray" Borderthickness = "3" Width = "200" Height = "30"> < Textbox. selectionbrush > < Lineargradientbrush Startpoint = "0, 0" Endpoint = "1, 1"> < Gradientstop Color = "Red" Offset = "0"/> < Gradientstop Color = "Yellow" Offset = "0.2"/> < Gradientstop Color = "Blue" Offset = "0.4"/> < Gradientstop Color = "Green" Offset = "0.6"/> < Gradientstop Color = "Orchid" Offset = "0.8"/> < Gradientstop Color = "Pink" Offset = "1"/> </ Lineargradientbrush > </ Textbox. selectionbrush > </ Textbox >
Caret brush attributes
The caret brush can be used to modify the cursor color:
<TextboxBorderbrush= "Gray"Borderthickness= "3"Width= "200"Height= "30"Caretbrush= "Red"/>