我正在寻找可以通过捏缩放的WP7应用程序的控件。我在codeplex上看到像DeepZoomContener一样,但效果不佳。有任何想法吗?我只需缩小即可缩放至150%。
问候。
答案 0 :(得分:5)
Thx Mick但这有点让我的布局搞砸了。我做了一些更简单的事。
我使用Silverlight Toolkit for WP7并将捏合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();
}
答案 1 :(得分:3)
Checkout Laurent Bugnions控制。