Windows Phone:如何在ScrollViewer(列表框)中禁用触摸滚动?

时间:2012-07-19 08:43:08

标签: windows-phone-7 listbox scroll touch scrollviewer

我有一个里面有一个列表框的滚动查看器:我需要通过触摸禁用垂直滚动,我该怎么办? 换句话说,用户无法通过触摸滚动(我已经放了按钮,但这是另一个故事)。

    <ScrollViewer  HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" x:Name="imagesScrollview" Width="480" Height="595" Margin="0,112,0,63">
        <ScrollViewer.RenderTransform>
            <CompositeTransform/>
        </ScrollViewer.RenderTransform>
        <ListBox Name="listavideo" Height="595" Width="480">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Button Width="470" Height="146" Background="White" BorderBrush="#346699" Click="apri_video" Name="{Binding Mylink}" Margin="5,0,5,0" Padding="5">
                        <Button.Content>
                            <StackPanel Orientation="Horizontal" Width="470">
                                <Image Source="{Binding Thumbnail}" Width="160" HorizontalAlignment="Left" VerticalAlignment="Top" />
                                <StackPanel Orientation="vertical" Width="285" Margin="0,0,0,0" Height="146">
                                    <StackPanel Orientation="Horizontal" Width="275" Margin="0,0,10,0">
                                        <TextBlock Width="275" FontSize="18" Text="{Binding Title}" Foreground="#34638f" TextWrapping="Wrap" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Width="275" Margin="0,0,10,0">
                                        <TextBlock Width="275" FontSize="14" Text="{Binding Description}" Foreground="#51504e" TextWrapping="Wrap" />
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                        </Button.Content>
                    </Button>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </ScrollViewer>

感谢。

1 个答案:

答案 0 :(得分:14)

<ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" Name="listavideo" Height="595" Width="480" >
    <ListBox.ItemTemplate>
        ...