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. 矩形的ManipulationStarting ManipulationDelta ManipulationInertiaStarting属性设置为 true, 应用程序的窗口订阅、和事件。 IsManipulationEnabledThe IsManipulationEnabled property of the Rectangle is set to true and the application's window subscribes to the ManipulationStarting, ManipulationDelta, and ManipulationInertiaStarting events. 本示例是演练中更大示例的一部分:正在创建您的第一个 Touch 应用程序。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希望ManipulationDelta ManipulationStarted ManipulationInertiaStarting接收、、、、和ManipulationBoundaryFeedback事件, 请将此属性设置为 true。 ManipulationCompleted ManipulationStartingSet 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. 有关响应操作的应用程序的示例, 请参阅演练:正在创建您的第一个 Touch 应用程序。For an example of an application that responds to manipulations, see Walkthrough: Creating Your First Touch Application.

适用于