UIElement.IsManipulationEnabled UIElement.IsManipulationEnabled UIElement.IsManipulationEnabled UIElement.IsManipulationEnabled Property

定義

取得或設定值,這個值表示是否在此 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

屬性值

如果在這個 UIElement 上啟用操作事件則為 true,否則為 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,且應用程式的視窗訂閱ManipulationStartingManipulationDelta,和ManipulationInertiaStarting事件。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>

備註

設定此屬性設定為 true,如果您想UIElement接收ManipulationStartingManipulationStartedManipulationDeltaManipulationInertiaStartingManipulationBoundaryFeedback,和ManipulationCompleted事件。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.

適用於