UIElement.ManipulationStarting Event


在首次创建操作处理器时发生。Occurs when the manipulation processor is first created.

 event EventHandler<System::Windows::Input::ManipulationStartingEventArgs ^> ^ ManipulationStarting;
public event EventHandler<System.Windows.Input.ManipulationStartingEventArgs> ManipulationStarting;
member this.ManipulationStarting : EventHandler<System.Windows.Input.ManipulationStartingEventArgs> 
Public Custom Event ManipulationStarting As EventHandler(Of ManipulationStartingEventArgs) 


下面的示例演示了 ManipulationStarting 事件的事件处理程序,并将 ManipulationContainer 设置为父元素,该元素接收操作事件,以便操作的坐标相对于父元素。The following example shows the event handler for the ManipulationStarting event and sets the ManipulationContainer to the parent element that receives the manipulation events so that the coordinates of the manipulation are relative to the parent element. 本示例摘自演练:创建您的第一个 Touch 应用程序中的一个更大的示例。This example is part of a larger example in Walkthrough: Creating Your First Touch Application.

void Window_ManipulationStarting(object sender, ManipulationStartingEventArgs e)
    e.ManipulationContainer = this;
    e.Handled = true;
Private Sub Window_ManipulationStarting(ByVal sender As Object, ByVal e As ManipulationStartingEventArgs)
    e.ManipulationContainer = Me
    e.Handled = True
End Sub


当用户将手指放在 IsManipulationEnabled 属性设置为 true 时,将在该元素上发生 ManipulationStarting 事件。The ManipulationStarting event occurs on an element that has the IsManipulationEnabled property set to true when the user puts a finger on it. 默认情况下,后续操作事件会报告与 IsManipulationEnabled 设置为 true的元素相关的操作位置。By default, subsequent manipulation events report the position of the manipulation relative to the element that has IsManipulationEnabled set to true. 您可以通过设置 "ManipulationContainer" 属性来指定该位置应与另一个元素相关。You can specify that the position should be relative to another element by setting the ManipulationContainer property. 例如,可以相对于元素的父级进行操作。For example, you can make the manipulation relative to the parent of the element.

你还可以在 ManipulationStarting的事件处理程序中执行以下操作:You can also do the following in an event handler for ManipulationStarting:

有关操作的详细信息,请参阅输入概述For more information about manipulations, see the Input Overview. 有关响应操作的应用程序的示例,请参阅演练:创建你的第一个 Touch 应用程序For an example of an application that responds to manipulations, see Walkthrough: Creating Your First Touch Application.

路由事件信息Routed Event Information

标识符字段Identifier field ManipulationStartingEvent
路由策略Routing strategy 冒泡Bubbling
委托Delegate EventHandler<TEventArgs>类型ManipulationStartingEventArgsEventHandler<TEventArgs> of type ManipulationStartingEventArgs.

Applies to