Reputation: 9242
Hi I just trying to edit the default style of a Slider Control, But When I tried to add it in App.Xaml of my app, it is showing error under the ThemeResource KeyWord, here is a part of the template
<Style x:Key="SomeStyle" TargetType="Slider">
<Setter Property="Background" Value="{ThemeResource SliderTrackBackgroundThemeBrush}" />
// Here ThemeResource is indicating error.
How can I resove that ? any help is appreciated :)
Upvotes: 0
Views: 63
Reputation: 21919
You need to use a StaticResource rather than a ThemeResource on Windows Phone 8. The SliderTrackBackgroundThemeBrush is from the Windows Runtime Slider control, not the Windows Phone Silverlight Slider control.
If you select your Slider in the designer you can right-click and choose the Edit Template.Edit a Copy... context menu to create a copy of the default template. you can then edit the template as needed.
In the default style starts as follows. Check out how it defines the Background property's setter:
<Style x:Key="SliderStyle1" TargetType="Slider">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Maximum" Value="10"/>
<Setter Property="Minimum" Value="0"/>
<Setter Property="Value" Value="0"/>
<Setter Property="Background" Value="{StaticResource PhoneChromeBrush}"/>
<Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
<Setter Property="Template">
<Setter.Value>
Upvotes: 1