DoubleTappedRoutedEventArgs Class

Stellt Ereignisdaten für das DoubleTapped-Ereignis bereit.

Vererbung

Object
  RoutedEventArgs
    DoubleTappedRoutedEventArgs

Syntax


public sealed class DoubleTappedRoutedEventArgs : RoutedEventArgs

Attribute

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Member

DoubleTappedRoutedEventArgsKlasse hat diese Membertypen:

Konstruktoren

DoubleTappedRoutedEventArgsKlasse hat diese Konstruktoren.

KonstruktorBeschreibung
DoubleTappedRoutedEventArgs Initializes a new instance of the DoubleTappedRoutedEventArgs class.

 

Methoden

The DoubleTappedRoutedEventArgs Klasse hat diese Methoden. Es erbt auch Methoden von Object Klasse.

MethodeBeschreibung
GetPosition Returns the x- and y-coordinates of the pointer position, optionally evaluated against a coordinate origin of a supplied UIElement.

 

Eigenschaften

Der DoubleTappedRoutedEventArgsKlasse hat diese Eigenschaften.

EigenschaftZugriffstypBeschreibung

Handled

Lese-/SchreibzugriffGets or sets a value that marks the routed event as handled. A true value for Handled prevents most handlers along the event route from handling the same event again.

OriginalSource

SchreibgeschütztGets a reference to the object that raised the event. (Geerbt von RoutedEventArgs)

PointerDeviceType

SchreibgeschütztGets the PointerDeviceType for the pointer device that initiated the associated input event.

 

Beispiele

Im folgenden Codebeispiel zeigt Szenario 3 das Eingabebeispiels. Dieser Code veranschaulicht einige Verwendungsmuster für die direkte Bearbeitung mithilfe der Holding-, Tapped-, DoubleTapped- und RightTapped-Ereignisse.


<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);
}


Anforderungen

Mindestens unterstützter Client

Windows 8 [Nur Windows Store-Apps]

Mindestens unterstützter Server

Windows Server 2012 [Nur Windows Store-Apps]

Namespace

Windows.UI.Xaml.Input
Windows::UI::Xaml::Input [C++]

Metadaten

Windows.winmd

Siehe auch

RoutedEventArgs

 

 

Anzeigen:
© 2014 Microsoft