我的应用中有以下滚动查看器。
<ScrollContentPresenter Grid.Row="0" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="1"
CanHorizontallyScroll="False" CanVerticallyScroll="False" CanContentScroll="True"
Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" OpacityMask="{x:Null}"
ScrollViewer.VerticalScrollBarVisibility="Disabled" />
<s:SurfaceScrollBar x:Name="PART_HorizontalScrollBar" Grid.Row="1" Height="Auto" MinWidth="30"
MinHeight="30" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" AutomationProperties.AutomationId="HorizontalScrollBar" Foreground="{x:Null}"
LargeChange="1" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Opacity="0" Orientation="Horizontal"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ViewportSize="{TemplateBinding ViewportWidth}"
Visibility="Visible"
Value="{Binding HorizontalOffset,
Mode=OneWay,
RelativeSource={RelativeSource TemplatedParent}}" />
问题在于,当我设置CanContentControl = True
时,滚动变得太快而无法让用户处理,这是因为即使单次轻弹也会导致水平偏移太大,任何机会我如何控制我的水平偏移没有编写IScrollInfo接口?
添加详细信息:此滚动查看器用于surfacelistbox,如下所示
<ControlTemplate x:Key="SurfaceListBoxHorizontalTemplate" TargetType="{x:Type s:SurfaceListBox}">
<s:SurfaceScrollViewer Background="{TemplateBinding Background}"
HorizontalScrollBarVisibility="Hidden"
Style="{StaticResource HorizontalSurfaceScrollViewerStyle}"
VerticalScrollBarVisibility="Disabled" >
<VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal" />
</s:SurfaceScrollViewer>
</ControlTemplate>
可能是因为当CanContentScroll = True时,VirtualizingStackPanel不起作用?我的内容是图片列表框。