有沒有什麼辦法來實現在Windows 8.1中的XAML內捏控和縮放圖像控件,我正在嘗試操縱delta事件。但那個事件不會被解僱,我也嘗試設置ManipulationMode =「全部」。Windows 8.1地鐵應用程序 - 捏和縮放圖像
<Image x:Name="kn" ManipulationMode="All" ManipulationDelta="kn_ManipulationDelta" HorizontalAlignment="Center" VerticalAlignment="Center" Height="315" Width="360" RenderTransformOrigin="0.5, 0.5">
<Image.RenderTransform>
<CompositeTransform></CompositeTransform>
</Image.RenderTransform>
</Image>
而在CS文件
private void kn_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
UIElement element = sender as UIElement;
CompositeTransform transform = element.RenderTransform as CompositeTransform;
if (transform != null)
{
transform.ScaleX *= e.Delta.Scale;
transform.ScaleY *= e.Delta.Scale;
transform.Rotation += e.Delta.Scale/Math.PI;
transform.TranslateX += e.Delta.Translation.X;
transform.TranslateY += e.Delta.Translation.Y;
}
}
有什麼我必須設置。或者我必須以其他方式去?
非常感謝:) – Stefan