UIElement.ManipulationStarting 事件
定義
發生於第一次建立操作處理器時。Occurs when the manipulation processor is first created.
public:
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. 此範例是 逐步解說:建立您的第一個觸控應用程式中較大範例的一部分。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
備註
ManipulationStarting IsManipulationEnabled 當使用者將手指放在屬性設為的專案上時,就會發生此事件 true
。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:
藉由設定屬性,指定使用者是否需要一個以上的手指來執行操作 ManipulationStartingEventArgs.IsSingleTouchEnabled 。Specify whether the user needs more than one finger to perform the manipulations by setting the ManipulationStartingEventArgs.IsSingleTouchEnabled property.
藉由將屬性設定為列舉,來指定要啟用的操作類型 ManipulationStartingEventArgs.Mode ManipulationModes 。Specify which types of manipulation are enabled by setting the ManipulationStartingEventArgs.Mode property to a ManipulationModes enumeration.
藉由設定屬性,指定單一手指旋轉的中心 ManipulationStartingEventArgs.Pivot 。Specify the center of a single-finger rotation by setting the ManipulationStartingEventArgs.Pivot property.
藉由呼叫方法來取消操作 ManipulationStartingEventArgs.Cancel 。Cancel the manipulation by calling the ManipulationStartingEventArgs.Cancel method.
如需操作的詳細資訊,請參閱 輸入總覽。For more information about manipulations, see the Input Overview. 如需回應操作的應用程式範例,請參閱 逐步解說:建立您的第一個觸控應用程式。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> 的 ManipulationStartingEventArgs。EventHandler<TEventArgs> of type ManipulationStartingEventArgs. |