WP7 滑块奇怪的行为 [英] WP7 slider strange behavior

查看:28
本文介绍了WP7 滑块奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Windows Phone 7 应用程序.我在几个页面上有滑块控件.但是,当我转到应用程序中的某个页面时,每个页面中的所有滑块控件的行为都很奇怪.

I'm developing Windows Phone 7 app. I have slider control on several page. However, when I go to a certain page within my app, all my slider controls in every page behave strangely.

症状是用户只能在很短的范围内拖动滑块上的拇指.

The symptom is that user can only drag the thumb on slider for very short range.

我提到的特定页面的代码和 XAML 没有问题.为什么它会导致所有滑块行为错误?

The certain page I mentioned has no problem with code and XAML. Why does it cause ALL sliders to behave wrongly ?

推荐答案

问题是使用工具包Gesture会导致Slider行为异常.所以当开始在 Slider 上操作时,您应该禁用 Gesture 监听器,然后在停止在 Slider 上操作时启用它.

The problem is that using toolkit Gesture will cause Slider to behave strangely. So when start manipulating on Slider, you should disable Gesture listener, then enable it when stop manipulating on Slider.

<Slider Height="84" Name="fixedSlider" ManipulationStarted="disableGestures" ManipulationCompleted="restoreGestures" />


GestureType prevGestureType;
private void disableGestures(object sender, ManipulationStartedEventArgs e) 
{
    prevGestureType = TouchPanel.EnabledGestures;
    TouchPanel.EnabledGestures = GestureType.None;
    fixedSlider.IsHitTestVisible = false;
}

private void restoreGestures(object sender, ManipulationCompletedEventArgs e) 
{
    TouchPanel.EnabledGestures = prevGestureType;
}

这篇关于WP7 滑块奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆