It's very easy to style the caret in
Silverlight 3. Look at that huge
TextBox with a caret in the rainbow colors:
You just need to set the
CaretBrush property:
| <TextBox FontSize="50" Width="100" Height="80"> |
| <TextBox.RenderTransform> |
| <ScaleTransform ScaleX="6" ScaleY="1"/> |
| </TextBox.RenderTransform> |
| <TextBox.CaretBrush> |
| <LinearGradientBrush x:Name="backgroundLinearGradientBrush" |
| MappingMode="RelativeToBoundingBox" |
| StartPoint="0,0" EndPoint="0,1"> |
| <LinearGradientBrush.GradientStops> |
| <GradientStop Color="Red" Offset="0" /> |
| <GradientStop Color="Orange" Offset="0.167" /> |
| <GradientStop Color="Yellow" Offset="0.333" /> |
| <GradientStop Color="Green" Offset="0.5"/> |
| <GradientStop Color="Blue" Offset="0.667" /> |
| <GradientStop Color="Indigo" Offset="0.833" /> |
| <GradientStop Color="Violet" Offset="1" /> |
| </LinearGradientBrush.GradientStops> |
| </LinearGradientBrush> |
| </TextBox.CaretBrush> |
| </TextBox> |
You can use any
Silverlight supported
Brush.
That's it!