locked
Why I can't catch the Pointer event,such as PointerPressed,PointerReleased and so on,of button ,but the event of click could be done?

Answers

  • Hello,

    You can add the TypedEventHandler for PointerPressed and so on in CoreWindow class in this way:

        window->PointerPressed += 
        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &YourAppClass::OnPointerPressed);
    
        window->PointerMoved += 
        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &YourAppClass::OnPointerMoved);
    
        window->PointerReleased += 
        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &YourAppClass::OnPointerReleased);
    

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.core.corewindow.aspx

    If you want to add a button click event for some control. You can add the function name in the Click property in xaml element.
     <Button x:Name="Scenario1Launch" Content="Launch Dialog" Margin="0,0,10,0" Click="Scenario1Launch_Click"/>
    You can follow this sample codes
    http://code.msdn.microsoft.com/windowsapps/Message-dialog-sample-00c928f5

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jesse Jiang Wednesday, April 25, 2012 7:08 AM
    Wednesday, April 18, 2012 3:25 AM