UIElement.IsManipulationEnabled 屬性

定義

取得或設定值,這個值表示是否在此 UIElement 上啟用操作事件。Gets or sets a value that indicates whether manipulation events are enabled on this UIElement.

public:
 property bool IsManipulationEnabled { bool get(); void set(bool value); };
public bool IsManipulationEnabled { get; set; }
member this.IsManipulationEnabled : bool with get, set
Public Property IsManipulationEnabled As Boolean

屬性值

如果在這個 true 上啟用操作事件則為 UIElement,否則為 falsetrue if manipulation events are enabled on this UIElement; otherwise, false. 預設為 falseThe default is false.

範例

下列範例會建立具有紅色矩形的應用程式。The following example creates an application that has a red Rectangle. 矩形的 IsManipulationEnabled 屬性會設定為 true,而應用程式的視窗會訂閱 ManipulationStartingManipulationDeltaManipulationInertiaStarting 事件。The IsManipulationEnabled property of the Rectangle is set to true and the application's window subscribes to the ManipulationStarting, ManipulationDelta, and ManipulationInertiaStarting events. 這個範例是逐步解說:建立您的第一個觸控應用程式中較大範例的一部分。This example is part of a larger example in Walkthrough: Creating Your First Touch Application.

<Window x:Class="BasicManipulation.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Move, Size, and Rotate the Square"
        WindowState="Maximized"
        ManipulationStarting="Window_ManipulationStarting"
        ManipulationDelta="Window_ManipulationDelta"
        ManipulationInertiaStarting="Window_InertiaStarting">
  <Window.Resources>

    <!--The movement, rotation, and size of the Rectangle is 
        specified by its RenderTransform.-->
    <MatrixTransform x:Key="InitialMatrixTransform">
      <MatrixTransform.Matrix>
        <Matrix OffsetX="200" OffsetY="200"/>
      </MatrixTransform.Matrix>
    </MatrixTransform>

  </Window.Resources>

  <Canvas>
    <Rectangle Fill="Red" Name="manRect"
                 Width="200" Height="200" 
                 RenderTransform="{StaticResource InitialMatrixTransform}"
                 IsManipulationEnabled="true" />
  </Canvas>
</Window>

備註

如果您想要 UIElement 接收 ManipulationStartingManipulationStartedManipulationDeltaManipulationInertiaStartingManipulationBoundaryFeedbackManipulationCompleted 事件,請將此屬性設定為 [true]。Set this property to true if you want the UIElement to receive the ManipulationStarting, ManipulationStarted, ManipulationDelta, ManipulationInertiaStarting, ManipulationBoundaryFeedback, and ManipulationCompleted events. 如需操作的詳細資訊,請參閱輸入總覽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.

適用於