I have a minor issue. We'd like to put as much stylistic items in the styles and outside of the control templates, to make themeing easier. So for the scrollbar's repeatbutton, I can get all of this to work but IsPressed. That only works from the template.
So the template is (basically):
<ControlTemplate x:Key="ScrollBarButtonCT" TargetType="{x:Type RepeatButton}">
<Border
x:Name="borderRepeatButton"
Margin="1"
CornerRadius="2"
Background="{TemplateBinding Background}">
<Path x:Name="pathArrow"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{DynamicResource ThumbBrush}"
Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="borderRepeatButton" Property="Background" Value="{DynamicResource ThumbPressedBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
And the style is
<Style x:Key="ScrollBarButtonStyle" TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Background" Value="{DynamicResource ScrollBarBGBrush}"/> <!-- borderRepeatButton -->
<Setter Property="OpacityMask" Value="{DynamicResource ThumbBrush}"/> <!-- pathArrow-->
<Setter Property="Template" Value="{StaticResource ScrollBarButtonCT}"/>
<Style.Triggers>
<!--<Trigger Property="IsPressed" Value="true"> .... this doesn't work coming from the style
<Setter Property="Background" Value="{DynamicResource ThumbPressedBrush}" />
</Trigger>-->
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource ScrollBarDisabledBGBrush}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource ThumbHoverBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
I can't get IsPressed to work from the style. Looking in Snoop IsPressed is raised just fine when using the control. What am I doing wrong? Thanks!