捏以缩放Windows Phone 7上的ListBox [英] Pinch to Zoom on ListBox on windows phone 7

查看:84
本文介绍了捏以缩放Windows Phone 7上的ListBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将捏缩放功能添加到数据绑定的ListBox.最有效的方法是什么?我已将ListBox放置在Grid控件中,并使它可滚动.

I am trying to add pinch to zoom feature to a data bound ListBox. What is the most efficient way to do this? I have placed the ListBox inside a Grid control and made it scrollable.

这是我当前的代码.

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="10,0,10,10" Background="Black" >
        <ListBox Name="lstText" FontSize="24"  Foreground="White" SelectionMode="Single" Margin="10,0,10,10"  ScrollViewer.VerticalScrollBarVisibility="Visible"  >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel >
                        <TextBlock Text="{Binding Text}" TextWrapping="Wrap"></TextBlock>                           
                    </StackPanel>                        
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
    <toolkit:GestureService.GestureListener>
        <toolkit:GestureListener 
            Tap="GestureListener_Tap" 
            PinchCompleted="GestureListener_PinchCompleted"
            Flick="GestureListener_Flick">

        </toolkit:GestureListener>
    </toolkit:GestureService.GestureListener>

推荐答案

列表框并非旨在缩放(通过捏合或任何其他方法).

The Listbox isn't designed to be zoomed (via pinching or any other method).

如果要实现此功能,则必须以不同的缩放级别重新绘制内容.
不过,您还有许多问题需要解决:

If you want to implement this you must redraw the content at the different zoom levels.
You'd have a number of issues to overcome though:

  • 您如何通知用户他们可以通过这种方式更改文本大小?
  • 如何避免影响滚动和选择列表框中项目的标准行为.
  • 关于换行和当前显示的文本,滚动应如何表现?
  • 不应使用列表来显示手机上的大量文本.如果需要显示大量文本,请在列表中添加一个简短的标题",然后在另一页中显示详细信息.这样,列表中的文本始终可以以足够大的方式显示,从而永远不需要更改,并且应该始终可读.
  • 这是您要克服的真正问题,还是只是您觉得很高兴的事情?手机不会仅用于您的应用程序,因此,如果用户在OS和其他应用程序中仍然需要使用固定文本大小的列表,为什么还要使用它.
  • 当您更改文本大小时,框架会重新绘制列表中的所有内容时,您可能会遇到性能方面的性能问题.您可以查看使用延迟加载,以便仅在缩放时重绘屏幕上显示的内容,但这会影响您确定尺寸变化时显示内容的顶部(和底部)的方式.

总结:几乎可以肯定,这是不必要的,并且非常复杂并且很难做好.如果您真的想尝试一下,请尝试一下,然后发布任何有问题的代码.

Summary: This is almost certainly unnecessary and will be very complicated and difficult to do well. If you really want to try this have a go and then post code with any problems.

这篇关于捏以缩放Windows Phone 7上的ListBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆