Windows Phone: how to disable touch scrolling in ScrollViewer (Listbox)?

南笙酒味 提交于 2019-12-10 09:45:39

问题


i have a scrollviewer with a listbox inside: i need to disable the vertical scroll by touch, how can i? In other words, the user can't scroll with the touch (i have put buttons, but this is another story).

    <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>

Thanks.


回答1:


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


来源:https://stackoverflow.com/questions/11557049/windows-phone-how-to-disable-touch-scrolling-in-scrollviewer-listbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!