Manipulation events are not fired on page with a listview - windows-phone-8

Now I'm developing windows phone 8.1 app with WinRT
I'm trying to support swipe-right-to-go-back gesture in my app.
I try to capture the manipulation events on my page. My page's root is a grid and have a ListView inside. I used the UIElement.AddHandler method with "handledEventsToo=true" to add the event handlers. But when I touch the screen, only the ManipulationStarting event is fired, other events seems to be eat by listview.
Could anyone tell me about the manipulation event behavior or other methods to implement this feature? Thanks!!

You won't normally capture events on LisView, beacause it has a ScrollViewer which intercepts them.
There is a way to do it - you will have to disable ScrollViewer and then perfrom some actions when the events are fired and perform scrolling manually. This answer will guide you.

In case someone encounters this page, I spent the better part of a week figuring out why manipulation events were only firing half the time on my UWP charts using the winRT xaml toolkit.
You may need to check that the background is not null on whatever element has the event handler attached. Templated controls are not necessarily hit test visible unless they have one. Otherwise, the input can go right through to the element behind it.
https://msdn.microsoft.com/en-us/windows/uwp/xaml-platform/events-and-routed-events-overview

Related

JavaScript onClick event in golang

In an attempt to automate some web/browser tasks with golang I reached a barrier when if comes comes to click, touch and swipe interaction.
Thanks to the amazing https://github.com/PuerkitoBio/goquery library I am able to parse webpages and I am able to interact with form sheets.
One integral part that is missing to automate pates is simulating mouse clicks that trigger javascript.
How would it be possible to implement this in golang? Do I need to simulate OS level mouse clicks or do browsers have an API that I can use?
You would need to use something like Selenium's WebDriver which has at least one go client

What event is fired when component is drawn on the screen

Using Flex SDK 4.14.1.
What event is fired when a component comes into view after scrolling a scroller?
I have a mobile app with a scroller component and it has a lot of items (about 4 screens worth of data), now I was wondering if a particular event was fired when these components came into view (drawn on the screen)?
What I want to do is dispatch an event when we get to a certain point down the 'page', but I cannot see any way to do this. I have tried creationComplete, show and addedToStage but they all seem to fire when the view is created, what I want is a solution something like the List component where items are rendered just before they are drawn on the screen.
Any suggestions greatly welcomed as dispatching these events at the start would both be a total waste of bandwidth, and a drain on resources that are valuable.
Thanks
So, in summary, there isn't one? Ah, ok, well that's fair enough.
I ended up putting a -load more- button in and calling my commands from that, works perfectly.
I am asking Apache to put in an event when an item is rendered on the screen, who the hell wants to load all of their data at start?

Windows phone 8.1 Handling App from Close button in the page

In my windows phone app, i have to delete some files when user navigates away from a page.
I have handled this on OnBackKeyPress event. This works perfectly fine.
The issue is newer updates of windows phone 8 and windows phone 8.1 also have close button on the top right corner. I have not found a way to handle this event.
Could anyone please let me know how can i handle this event and delete the files.
Rather than using OnBackKeyPress, you should use OnNavigatedFrom. This event is triggered whenever the user leaves the page, no matter how.
If you need to handle only the specific case when the app is suspended/terminated, you can subscribe to the Deactivated and Closing events on the PhoneApplicationService.
PhoneApplicationService.Current.Deactivated += yourHandler;
Note that is the your event handler is a non-static method declared in your page, then you must make sure to unsubscribe the event when leaving the page, to avoid a memory leak. To know when to unsubscribe, you can stick to your OnBackKeyPress logic.

Why does adding a ManipulationDelta event handler to an Image prevent scrolling?

I'm encountering a problem while attempting to add functionality like pinch-zoom to an application that features an Image control inside of a ScrollView, which is inside a FlipView. The Image control and ScrollView control are in the ItemTemplate of the FlipView.
The idea is that if the user pinch-zooms on the Image it will activate code which will create and display an enlarged version of the image in the Image control. (The Image control in this case contains a PDF page, so we want a bigger version of the PDF page, instead of just an enlarged and fuzzier view of the PDF page).
If I attach a ManipulationDelta event handler to the Image, it will catch ManipulationDelta events produced by the pinch-zoom gesture, which I can then use to create the PDF zoom effect. However...now it will not catch scroll (drag?) gestures. Or rather, these too get caught by the ManipulationDelta event handler. I'd rather avoid having to implement code at this point to handle scrolling programmatically. Do I have any options for somehow bubbling up (or "over"?) the ManipulationDelta events to whatever would handle the scrolling? I would think this would happen already, the event would bubble up to the ScrollView which would then handle scrolling. But it appears to not be happening that way.
I have e.Handled set to false in the ManipulationDelta event handler. And the ManipulationMode on the IMage control is set to "All". I've tried "Scale" but this didn't help.
Thank you!
The ScrollViewer in WinRT is optimized for performance and uses DirectManpulation under the hood. That's why it's tricky to have both scrolling from the ScrollViewer and gestures inside it.
This blog post from Rob Caplan (MS employee) gives more information:
http://blogs.msdn.com/b/wsdevsol/archive/2013/02/16/where-did-all-my-gestures-go.aspx
Unfortunately there is no good solution if the app needs both scrolling and gestures (for example, to detect CrossSlides against the scrolling). In this case the only option to get the Pointer messages everywhere is to disable Direct Manipulation everywhere, but that disables scrolling as well. To get that back the app will need to detect the scrolling gestures itself and then navigate the ScrollViewer to the new location with ScrollToHorizontalOffset or ScrollToVerticalOffset or by updating the SelectedIndex. This is tricky and will be noticeably slower than letting the ScrollViewer do its thing. It should be avoided if at all possible.
Hope this helps

Air Native Window Active Window Change

I have a Adobe Air app (AS3, not Flex) that has 2 windows. When I click away from them onto another desktop program, I get an "Deactivate" Event (as you would expect).
When I click on say Window#1 I get an "Activate" Event (as you would expect).
But when I go from Window#1 to Window#2, I get nothing. And I believe this is because the Air application is still the active program, Just a Different Window.
But I have the need to know when I go from 1 window to another.
The horrible solutions I have come up with so far is to have an onEnterFrame and check if the current window is the active window. But I would much prefer to do it a much better way that such a hack.
I have gone though Stage, NativeApplication and Native Window Events and none of them do what I need. Can anyone point me to another Event I may have overlooked?
Listen for window activation events directly on the NativeWindow object. (All display objects dispatch activation/deactivation events, but these are triggered by the application -- or SWF object in the browser -- getting or losing the OS focus.)