다음을 통해 공유


DoubleTappedEventHandler 대리자

정의

DoubleTapped 이벤트를 처리할 메서드를 나타냅니다.

public delegate void DoubleTappedEventHandler(Platform::Object ^ sender, DoubleTappedRoutedEventArgs ^ e);
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.Guid(4154786233, 57975, 22033, 135, 176, 14, 6, 7, 98, 33, 131)]
public delegate void DoubleTappedEventHandler(object sender, DoubleTappedRoutedEventArgs e);
Public Delegate Sub DoubleTappedEventHandler(sender As Object, e As DoubleTappedRoutedEventArgs)

매개 변수

sender
Object

Platform::Object

이벤트 처리기가 연결된 개체입니다.

e
DoubleTappedRoutedEventArgs

이벤트에 대한 이벤트 데이터입니다.

특성

예제

다음 코드 예제에서는 입력 샘플의 시나리오 3을 보여줍니다. 이 코드는 Holding, Tapped, DoubleTapped 및 RightTapped 이벤트를 사용하여 직접 조작하기 위한 몇 가지 사용 패턴을 보여 줍니다.

<StackPanel>
  <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
    <Button x:Name="scenario3Reset" Content="Reset" Margin="0,0,10,0" 
      Click="Scenario3Reset" />
  </StackPanel>
  <StackPanel Orientation="Horizontal">
    <Border x:Name="bTapped" Background="Red" 
      Height="100" Width="150" CornerRadius="20" Margin="20" 
      BorderBrush="Black" BorderThickness="2">
      <TextBlock Style="{StaticResource BasicTextStyle}" Text="Tap" 
        HorizontalAlignment="Center" VerticalAlignment="Center"/>
    </Border>
    <Border x:Name="bDoubleTapped" Background="Red" 
      Height="100" Width="150" CornerRadius="20" Margin="20" 
      BorderBrush="Black" BorderThickness="2">
      <TextBlock Style="{StaticResource BasicTextStyle}" 
        Text="Double Tap" 
        HorizontalAlignment="Center" VerticalAlignment="Center"/>
    </Border>
    <Border x:Name="bRightTapped" Background="Red" 
      Height="100" Width="150" CornerRadius="20" Margin="20" 
      BorderBrush="Black" BorderThickness="2">
      <TextBlock Style="{StaticResource BasicTextStyle}" 
        Text="Press, Hold and Lift" TextWrapping="Wrap" 
        HorizontalAlignment="Center" VerticalAlignment="Center"/>
    </Border>
    <Border x:Name="bHolding" Background="Red" 
      Height="100" Width="150" CornerRadius="20" Margin="20" 
      BorderBrush="Black" BorderThickness="2">
      <TextBlock Style="{StaticResource BasicTextStyle}" Text="Hold" 
        HorizontalAlignment="Center" VerticalAlignment="Center"/>
    </Border>
  </StackPanel>
</StackPanel>
public Scenario3()
{
    this.InitializeComponent();
    bTapped.Tapped += new TappedEventHandler(bTapped_Tapped);
    bDoubleTapped.DoubleTapped += new DoubleTappedEventHandler(
        bDoubleTapped_DoubleTapped);
    bRightTapped.RightTapped += new RightTappedEventHandler(
        bRightTapped_RightTapped);
    bHolding.Holding += new HoldingEventHandler(bHolding_Holding);
}

private void Scenario3UpdateVisuals(Border border, String gesture)
{
    switch (gesture.ToLower())
    {
        case "holding":
            border.Background = new SolidColorBrush(Colors.Yellow);
            break;
        default:
            border.Background = new SolidColorBrush(Colors.Green);
            break;
    }

    ((TextBlock)border.Child).Text = gesture;
}

private void bHolding_Holding(object sender, HoldingRoutedEventArgs e)
{
    string holdingState = 
        (e.HoldingState == Windows.UI.Input.HoldingState.Started) ? 
        "Holding" : "Held";
    Scenario3UpdateVisuals(sender as Border, holdingState);
}

private void bDoubleTapped_DoubleTapped(object sender, 
    DoubleTappedRoutedEventArgs e)
{
    Scenario3UpdateVisuals(sender as Border, "Double Tapped");
}

private void bRightTapped_RightTapped(object sender, 
    RightTappedRoutedEventArgs e)
{
    Scenario3UpdateVisuals(sender as Border, "Right Tapped");
}

private void bTapped_Tapped(object sender, TappedRoutedEventArgs e)
{
    Scenario3UpdateVisuals(sender as Border, "Tapped");
}

private void Scenario3Reset(object sender, RoutedEventArgs e)
{
    Scenario3Reset();
}

private void Scenario3Reset()
{
    bTapped.Background = new SolidColorBrush(Colors.Red);
    bHolding.Background = new SolidColorBrush(Colors.Red);
    bDoubleTapped.Background = new SolidColorBrush(Colors.Red);
    bRightTapped.Background = new SolidColorBrush(Colors.Red);
}

적용 대상