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

查看:78
本文介绍了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上进行操作时,应禁用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天全站免登陆