Share via


Control Styling Tips: TextBox

Hello!
In this article, I’d like to provide you with some information and tips that you’ll find useful when styling a Silverlight 3 TextBox.

Visual states. CommonStates (Normal, MouseOver, Disabled and ReadOnly), FocusStates (Unfocused and Focused) and ValidationStates (Valid, InvalidUnfocused and InvalidFocused).

Template parts. ContentElement (FrameworkElement)

Try template binding: Background, BorderBrush, Foreground, BorderThickness or Padding.

Here’s some artwork you might want to try turning into a TextBox:

textbox 

The XAML that resembles the artwork is:

<Grid Height="20" Width="120">
      <Rectangle Fill="#FF333333" RadiusX="5" RadiusY="5"/>
      <TextBlock Margin="5,0" Foreground="White" Text="Lorem" VerticalAlignment="Center"/>
</Grid>

To create a real TextBox, select [Grid] and click Tools > Make Into Control > TextBox > OK. After you have done this, you should now have a working TextBox!

- Steve