操作 SurfaceScrollViewer 内容
我正在深入研究 WPF,但我无法解决多点触控的一些问题。
我有两个关于 SurfaceScrollViewer 的问题。
首先更简单:我正在使用 SurfaceScrollViewer 显示一张大照片,因此我可以平移,但我不知道如何让内容在屏幕中心开始。我在 SScrollViewer 中找不到任何本机对齐属性。如果我给内容边距,它就会裁剪它。如果我做 RenderTransform 也是一样。如果我执行 LayoutTransform,它似乎不会发生变化。有什么想法吗?
我还想在 SurfaceScrollViewer 内部提供此内容缩放功能。实际上,我正在尝试使用 SSV 的弹性效果进行缩放和平移。我应该手动写出操作还是可以修补 SSV 中的功能以便能够缩放? SSV 似乎将第二次触摸吸收到了其平移功能中。我必须编写一个操作处理程序来向内容发送多次触摸,对吗?
我的代码现在看起来像这样:
<Grid x:Name="LayoutGrid" Width="1950" Height="1118" HorizontalAlignment="Center" >
<s:SurfaceScrollViewer x:Name="scrollViewer" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<local:FloorView x:Name="floorViewer" Width="4209" Height="1442" >
<local:FloorView.LayoutTransform>
<TranslateTransform X="1000" />
</local:FloorView.LayoutTransform>
</local:FloorView>
</s:SurfaceScrollViewer>
</Grid>
非常感谢任何帮助。谢谢!
I'm diving into WPF here and I can't figure some things with multitouch.
I've got two questions about SurfaceScrollViewer.
Easier one first: I've got a large photo I'm displaying with SurfaceScrollViewer, so I can pan around, but I can't figure out how to get the content to start out centered in the screen. I can't find any native alignment properties in SScrollViewer. If I give the content margins, it crops it. Same if I do a RenderTransform. If I do a LayoutTransform, it doesn't seem to do change. Any ideas?
I also want to give this content Zoom functionality while inside SurfaceScrollViewer. Really I'm trying to zoom and pan with the elastic effects of SSV. Should I write the manipulations out by hand or can I patch the functions in SSV to be able to zoom? It seems like SSV absorbs 2nd touches into its panning function. I'd have to write a Manipulation handler to send multi touches to the content, right?
My code looks something like this right now:
<Grid x:Name="LayoutGrid" Width="1950" Height="1118" HorizontalAlignment="Center" >
<s:SurfaceScrollViewer x:Name="scrollViewer" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<local:FloorView x:Name="floorViewer" Width="4209" Height="1442" >
<local:FloorView.LayoutTransform>
<TranslateTransform X="1000" />
</local:FloorView.LayoutTransform>
</local:FloorView>
</s:SurfaceScrollViewer>
</Grid>
Any help is much appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
弄清楚第一部分:
看起来我必须控制 SSV 上的操作事件才能添加缩放。
figured out the first part:
looks like i'll have to control manipulation events on the SSV to add zoom.
找出第二部分,放大滚动查看器,
不要忘记处理touchup事件
boom!
figured out the second part to zoom inside scrollviewer
don't forget to handle touchup events
boom!