UIElement.ManipulationStarting UIElement.ManipulationStarting UIElement.ManipulationStarting 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事件发生在属性设置为的元素上。 ManipulationStartingThe 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.