Customizing the NumericUpDown With Styles
The NumericUpDown control can be skinned using the standard Silverlight method of setting Styles in the App.xaml file of your Silverlight project.
You need to login to Download the default NumericUpDown styles, If you do not have a login you can register for free!
Example of how to Apply a Skin to the NumericUpDown
These styles are placed in your XAML and referred to using the Style property:
<Style TargetType="local:NumericUpDown">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:NumericUpDown">
<Grid x:Name="RootElement">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="16" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBox x:Name="ElementInput" Grid.Column="0" Grid.RowSpan="2" Text="0" Padding="3" FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}"
FontStyle="{TemplateBinding FontStyle}" Foreground="{TemplateBinding Foreground}" />
<RepeatButton x:Name="ElementUp" Grid.Column="1" Grid.Row="0" Width="16">
<RepeatButton.Content>
<Polygon Points="0,3 4,-1 8,3 0,3" StrokeThickness="0" Fill="#ff313131" />
</RepeatButton.Content>
</RepeatButton>
<RepeatButton x:Name="ElementDown" Grid.Column="1" Grid.Row="1" Width="16">
<RepeatButton.Content>
<Polygon Points="0,-1 4,3 8,-1 0,-1" StrokeThickness="0" Fill="#ff313131" />
</RepeatButton.Content>
</RepeatButton>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
As you can see, styling is a powerful method of customizing the controls to suite the look and feel of your Silverlight application.
Rate this:
1 Star
2 Star
3 Star
4 Star
5 Star
11 Ratings / 3.0 Average