Поделиться через


UIElement.IsManipulationEnabled Свойство

Определение

Возвращает или задает значение, указывающее, включены ли события манипуляции в этом 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Значение , falseесли события манипуляции включены для этогоUIElement; в противном случае . Значение по умолчанию — false.

Примеры

В следующем примере создается приложение с красным прямоугольником. Свойство IsManipulationEnabled прямоугольника имеет значение true, а окно приложения подписывается на ManipulationStartingсобытия ManipulationDeltaи ManipulationInertiaStarting события. Этот пример является частью более крупного примера в пошаговом руководстве. Создание первого сенсорного приложения.

<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 этому свойству значение true, если требуется получать ManipulationStartingсобытия , ManipulationStarted, ManipulationDelta, ManipulationInertiaStartingи ManipulationBoundaryFeedbackManipulationCompleted события. Дополнительные сведения о манипуляциях см. в обзоре входных данных. Пример приложения, реагирующего на манипуляции, см. в пошаговом руководстве. Создание первого сенсорного приложения.

Применяется к