【发布时间】:2014-09-03 17:39:54
【问题描述】:
我发现这个example 的接缝正是我所需要的。但它不适用于通用应用程序。
Xaml:
<Rectangle Name="TestRectangle"
Width="200"
Height="200"
Fill="Blue"
ManipulationMode="All" />
C#:
public MainPage()
{
InitializeComponent();
// Add handler for the ManipulationDelta event
TestRectangle.ManipulationDelta += new ManipulationDeltaEventHandler((sender, e) =>
{
UIElement element = sender as UIElement;
CompositeTransform transform = element.RenderTransform as CompositeTransform;
if (transform != null)
{
transform.ScaleX *= e.DeltaManipulation.Scale;
transform.ScaleY *= e.DeltaManipulation.Scale;
transform.Rotation += e.DeltaManipulation.Rotation * 180 / Math.PI;
transform.TranslateX += e.DeltaManipulation.Translation.X;
transform.TranslateY += e.DeltaManipulation.Translation.Y;
}
});
TestRectangle.RenderTransform = new CompositeTransform();
}
这里是错误:
“Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs”不包含“DeltaManipulation”的定义,并且找不到接受“Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs”类型的第一个参数的扩展方法“DeltaManipulation” (您是否缺少 using 指令或程序集引用?)
我该如何解决?
【问题讨论】:
标签: c# windows-8.1 windows-phone-8.1 win-universal-app