WPF-Base/WPF路由事件-9-操作/MainWindow.xaml.cs

30 lines
769 B
C#

using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace WPF路由事件_9_操作;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Canvas_OnManipulationStarting(object? sender, ManipulationStartingEventArgs e)
{
e.ManipulationContainer = Canvas;
e.Mode = ManipulationModes.All;
}
private void Canvas_OnManipulationDelta(object? sender, ManipulationDeltaEventArgs e)
{
var element = (UIElement)e.Source;
var matrix = ((MatrixTransform)element.RenderTransform).Matrix;
var eDeltaManipulation = e.DeltaManipulation;
}
}