我想知道我怎么可以检测到用户控件做了一个放大/缩放手势? 以下是我的XAML代码。 我怎样才能在“Grid_OnManipulationDelta”或“Grid_OnManipulationCompleted”的方法检测呢? 为感谢名单提前帮助。
<UserControl x:Class="HCMainWPF.Views.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:views="clr-namespace:HCMainWPF.Views" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Name="ZMainView">
<Canvas x:Name="grid">
<Canvas.RenderTransform>
<ScaleTransform x:Name="zoom" ScaleX="1" ScaleY="1" />
</Canvas.RenderTransform>
<Canvas.Triggers>
<EventTrigger RoutedEvent="Grid.ManipulationCompleted">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="00:00:02" From="320" Storyboard.TargetName="ZMainView"
Storyboard.TargetProperty="Height" To="960"/>
<DoubleAnimation Duration="00:00:02" From="270" Storyboard.TargetName="ZMainView"
Storyboard.TargetProperty="Width" To="810"/>
<DoubleAnimation Duration="00:00:02" From="1" Storyboard.TargetName="zoom"
Storyboard.TargetProperty="ScaleX" To="3"/>
<DoubleAnimation Duration="00:00:02" From="1" Storyboard.TargetName="zoom"
Storyboard.TargetProperty="ScaleY" To="3"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Canvas.Triggers>
<Grid Height="280" Width="280" IsManipulationEnabled="True"
ManipulationStarting="Grid_OnManipulationStarting"
ManipulationDelta="Grid_OnManipulationDelta"
ManipulationCompleted="Grid_OnManipulationCompleted">
<Grid.RowDefinitions>
<RowDefinition Height="1.66*"/>
<RowDefinition Height="1.66*"/>
<RowDefinition Height="1.66*"/>
<RowDefinition Height="1.66*"/>
<RowDefinition Height="1.66*"/>
<RowDefinition Height="1.66*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3.33*"/>
<ColumnDefinition Width="3.33*"/>
<ColumnDefinition Width="3.33*"/>
</Grid.ColumnDefinitions>
</Grid>
</Canvas>
</UserControl>