Got a weird problem here. I have created a template for a ListBox based on the standard template (i.e. I have not changed anything other than what I indicate below).
I am trying to add a couple of buttons to the side of the template so that I can scroll the ScrollViewer (which is part of the standard ListBox template) left and right. The problem is that it only recognises the ScrollBar.PageLeftCommand OR the ScrollBar.PageRightCommand ... I cannot get it to response to both.
In other words if I click the right button it will page right, but if I click the left button it doesn't do anything. Depending on the ordering of the Button in the XAML that will dictate which command works and which doesn't (it appears the command works for the last button defined in the XAML).
<ControlTemplate TargetType="{x:Type s:SurfaceListBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.137*"/>
<ColumnDefinition Width="0.726*"/>
<ColumnDefinition Width="0.137*"/>
</Grid.ColumnDefinitions>
<Border x:Name="Border" Grid.ColumnSpan="1" Grid.Column="1">
<s:SurfaceScrollViewer x:Name="scrollViewer" >
<ItemsPresenter />
</s:SurfaceScrollViewer>
</Border>
<s:SurfaceButton x:Name="rightScroll" Content=">" Command="ScrollBar.PageRightCommand" CommandTarget="{Binding ElementName=scrollViewer}" Grid.Column="2" />
<s:SurfaceButton x:Name="leftScroll" Content="<" Command="ScrollBar.PageLeftCommand" CommandTarget="{Binding ElementName=scrollViewer}"/>
</Grid>
</ControlTemplate>
(Yes this is using the Surface classes but I have tried it with normal ones and I get the same behaviour..)
I have had a look at it running with Snoop but it tells me nothing useful about the commands - according to Snoop both the commands are handled successfully!