简体   繁体   中英

WP7 Toggle switch in a Pivot control?

有没有办法控制轻弹动作的阈值来打开/关闭切换开关,这样它就不会弄乱枢轴控制的导航?

Sorry, but I'm going to avoid you're question (I can't answer it anyway) and suggest you use a different approach.
You could (I assume) use a checkbox to just as easily provide the option to the person using the application. Afterall a toggle switch has the same functionality as a checkbox (specify/choose between two states) it just implements the interaction differently.

The toggle switch has not been designed/built (AFAIK) to support being used on top of something which also supports the same gesture.
As a general rule of usability, having controls on top of each other (or even next to each other) which support the same gesture is likely to cause problems for the user. Even if the problems are through accidentaly triggering the wrong gesture or expectations about how their gesture will be interpretted.

In summary: this is a really tricky problem to solve; I don't think you can with the controls as they are; and the problem goes away entirely if you use a different control for toggling anyway.

I've had the same problem with my codermate, we've been digging this for many hours and we finally reached the top of the hill and we came up with a solution. This solution works for the bing map control:

on mouse enter: myMapControl.CaptureMouse(); on mouse leave: myMapControl.ReleaseMouseCapture();

And there you go, when you'll navigate inside the map the pivot won't do transition ;) If you don't get the point, just poke me and I'm going to explain with real code (I'm quite busy right now).

Cheers

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

在根枢轴控件中设置IsHitTestVisible = false

The solution to this is simple, and comes from my experience with Android and iPhone application development.

simply make sure you only tap into the OnMouseLeave event - not the OnChecked or the OnMouseClick as these will accidentally fire just by touching the toggle.

You want make sure that they were touching it when they let go of the screen, and this (unless you put the toggle on the edge of the screen will almost never be the case

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM