WP7 slider strange behavior

夙愿已清 提交于 2019-12-12 05:39:14

问题


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.

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


回答1:


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;
}



回答2:


Slider class has property SmallChange and if you look on the slider template, you will see, that when user tap on slider - value changes only on the small change. If you want to avoid this, you need to create custom slider behavior.



来源:https://stackoverflow.com/questions/13342825/wp7-slider-strange-behavior

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!