The team blog of the Expression Blend and Design products.
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 Slider.
Visual states. CommonStates (Normal, MouseOver and Disabled) and FocusStates (Unfocused and Focused) and the following template parts:
Used when the Slider is oriented horizontally:
HorizontalTemplate (FrameworkElement) HorizontalThumb (Thumb) HorizontalTrackLargeChangeDecreaseRepeatButton (RepeatButton) HorizontalTrackLargeChangeIncreaseRepeatButton (RepeatButton)
HorizontalTemplate (FrameworkElement)
HorizontalThumb (Thumb)
HorizontalTrackLargeChangeDecreaseRepeatButton (RepeatButton)
HorizontalTrackLargeChangeIncreaseRepeatButton (RepeatButton)
Used when the Slider is oriented vertically:
VerticalTemplate (FrameworkElement) VerticalThumb (Thumb) VerticalTrackLargeChangeDecreaseRepeatButton (RepeatButton) VerticalTrackLargeChangeIncreaseRepeatButton (RepeatButton)
VerticalTemplate (FrameworkElement)
VerticalThumb (Thumb)
VerticalTrackLargeChangeDecreaseRepeatButton (RepeatButton)
VerticalTrackLargeChangeIncreaseRepeatButton (RepeatButton)
Template binding. Try template binding Background, BorderBrush, Foreground, BorderThickness or Padding.
Slider tips.
Make Into Control. A visual designer has comped out some Slider states together with the MouseOver and Pressed states of the HorizontalThumb part:
The comp artwork is then imported into Blend 3. Here’s the XAML for the Normal state. Note, this XAML is not yet a styled Slider, it is still just artwork consisting of Panels and Shapes.
<Grid Width="146" Height="17" > <Rectangle x:Name="track" Fill="#FF3D3D3D" StrokeThickness="0" Margin="0,6" /> <Rectangle x:Name="thumb" Fill="Gray" RadiusX="3" RadiusY="3" Width="7"/> </Grid>
Practice making the artwork into a Slider with the following steps.
You should now have a working PasswordBox!
- Steve
The last word of the article has a typo: "PasswordBox" should be "Slider".
Carl.