我正在寻找允许双指缩放的 WP7 应用程序控件。我在像 DeepZoomContener 这样的 codeplex smth 上看到过,但效果不佳。有任何想法吗?我只需要通过捏合即可缩放到 150%。
问候。
最佳答案
Thx Mick 但这有点弄乱了我的布局。我做了更简单的事情。
我使用 Silverlight Toolkit for WP7并将 pinch GetureListener 添加到我的网格中
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener PinchDelta="GestureListener_PinchDelta" />
</toolkit:GestureService.GestureListener>
事件中的代码
private void GestureListener_PinchDelta(object sender, PinchGestureEventArgs e)
{
if (e.DistanceRatio < 1.0 || e.DistanceRatio > 1.4)
{
return;
}
// Create the animation for pinch
Storyboard storyboard = new Storyboard();
DoubleAnimation pinchXAnimation = new DoubleAnimation();
pinchXAnimation.To = e.DistanceRatio;
pinchXAnimation.Duration = TimeSpan.FromSeconds(0.3);
storyboard.Children.Add(pinchXAnimation);
Storyboard.SetTargetProperty(pinchXAnimation, new PropertyPath("GridScaling.ScaleX"));
Storyboard.SetTarget(pinchXAnimation, GridScaling);
DoubleAnimation pinchYAnimation = new DoubleAnimation();
pinchYAnimation.To = e.DistanceRatio;
pinchYAnimation.Duration = TimeSpan.FromSeconds(0.3);
storyboard.Children.Add(pinchYAnimation);
Storyboard.SetTargetProperty(pinchYAnimation, new PropertyPath("GridScaling.ScaleY"));
Storyboard.SetTarget(pinchYAnimation, GridScaling);
storyboard.Begin();
}
关于c# - 缩放 WP7 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4531806/