How to disable GestureListener? - windows-phone-7

I have a gesture listener. I use DoubleTap to toggle a ListBox Visibility on my page.
And Flick gesture to flick images.
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener
DoubleTap="GestureListener_DoubleTap"
Flick="GestureListener_Flick"/>
</toolkit:GestureService.GestureListener>
I'am trying to disable the flick gesture when the ListBox is visible.
Can anyone help here?
Thanks in advance!
G.

You could probably do this with a custom behaviour but I'm not really up to speed on them. I would just do the following in code behind:
GestureListener listener = GestureService.GetGestureListener(myControl);
listener.Flick -= GestureListener_Flick;

I found out that you can disable GestureListeners through flicking this boolean off:
http://msdn.microsoft.com/en-us/library/system.windows.uielement.ishittestvisible(v=vs.95).aspx
Might be simpler in some scenarios, but it will of course disable likely all events tied to that object.

See my question about WP7 slider strange behavior
I use
TouchPanel.EnabledGestures = GestureType.None
to disable gesture. Remember to save previous GestureType

Related

Disable Manual Zooming on UIScrollView

I have a project with a UIScrollView which I want to control the zooming programmatically but not via user interaction. I have tried setting the multipleTouchedEnabled property to false. This doesn't work. When I pinch on the scroll view, the scrollViewDidZoom and viewForZoomingInScrollView are called. I have also tried subclassing UIScrollView and overriding addGestureRecognizer and disabling the gesture which passes a [gesture [isKindOfClass: [UIPinchGestureRecognizer class]]. After breakpointing on that override, no gestures are matched.
So how can I have zooming on the scroll view but not allow manual interaction with the zooming. I still need single finger panning for normal scrolling.
Try to set scrollView.pinchGestureRecognizer.enabled = NO;

GestureOverlay view needs to override parent's(View Pager/Scroll View) Touch event

I've spent the last couple of days reading through docs and answers trying to get a solution for this. So I resort to this, with a probability of being a duplicate, as a cry for help.
I have a GestureOverlay panel to read horizontal swipe gestures. This sits on top of a view pager.
I need to disable the functioning of the view pager when the touch event is read on the gesture panel.
I've extended ViewPager to let me enable and disable it with a member method.
Overrode the onTouch event of gesture to return true (consume the event) and disallow Intercept touch event on its parent (only on action_move/down). I also tried to disable the view pager onTouch, but the viewpager's on touch event is fired first
How do I achieve this?

Ignore events from children of a ScrollViewer while scrolling

Alright here is my issue. I have a Pivot view. Inside that pivot view a scroll viewer containing many stack panels and grids. On some of the grids I have MouseButton Up Events. What is happening is if I flick the scroll it scrolls as expected but when I release my finger most of the time it fires off the event from mousebutton up. Because technically I let up. The problem is these grids completely fill the screen so finding an area without a mousebutton up to scroll is near impossible. What I want to happen is if the user flicked to scroll I would ideally like it to ignore the mousebutton up event. It does this successfully sometimes but pretty rarely and I have noticed I have to flick pretty fast for it to work as expected.
Any ideas on how to prevent this activity. I assume there is as Listboxes work perfect.
i think u should use windows phone toolkit GestureListener to recognize flick event
I ended up setting a bool for when the scrollviewer was scrolling and based on that allowing the mouseup action to run my code. Here is the the site I used to implement the bool based on scrolling status.
http://blogs.msdn.com/b/ptorr/archive/2010/07/23/how-to-detect-when-a-list-is-scrolling-or-not.aspx

SwipeGesture on ImageView

I am working on an app (its actually a game) that needs to detect Swipe Gestures. When I do swipe on my image view, the image for the image view needs to be changed, but unfortunately it is not working as expected.
When I add the swipe gesture object to self.view, the desired action is performed whenever I swipe my finger to any location in the view, but I want this action to be performed only when I swipe my finger over the imageView.
On the other hand, when I try to add the swipe gesture to the image view, it doesn't respond to the gesture event.
Please reply if you have the solution to this problem!
Thanks in advance!
It sounds like your UIImageView has userInteractionEnabled set to NO. Try setting yourImageView.userInteractionEnabled = YES and adding your swipe gesture recognizer to the UIImageView.
I too faced the same issue..
The option 'User Interaction Enabled' under Attributes Inspector(available in Inspector window of Interface Builder) was unchecked,
Enabling it solved my problem.
done using storyboard...
Thanks

How to stop the WP7 pivot control handling the Flick Gesture event in Silverlight Toolkit

I have a Pivot Control in my WP7 app that by nature responds to left and right swipes to move between the pivot items.
I then want to use the Flick Gesture on a UserControl (a small UI segment on my page) for something else.
My user control does handle the event but so does the Pivot control, so it navigates to the next item. I have not figured out how to stop the event when the usercontrol handles it.
Is it possible to use a sub control with the flick gesture within a WP7 Pivot Control?
eg:
private void glBlinds_Flick(object sender, FlickGestureEventArgs e)
{
//do stuff
e.Handled = true;
}
This solution posted recently seems to be working out for people for dealing with gesture conflicts on pano / pivot. You might like to check it out.
Preventing the Pivot or Panorama controls from scrolling
The short answer is don't put a control which supports a gesture on top of another control which also supports the same gesture.
Please see this answer to a very similar question for a slightly longer response: WP7 Toggle switch in a Pivot control?
I found this works well for incorporating a slider on a pivot item:
LayoutRoot
Pivot
PivotItem
Grid
Scrollviewer
[Content goes here, I use another grid]
Slider
If I skip the grid and place the slider inside the scrollviewer it doesn't work. I stumbled upon this solution as I wanted to support landscape and still have the slider visible / usable.
You might be able to place your small UI segment for the gesture similar to where I placed my slider.

Resources