Reputation: 917
In C# UWP app how to disable pointer wheel on scrollviewer, and still be able to move scroll with touch?
I have situation like this:
<ScrollViewer
VerticalScrollMode="Disabled"
VerticalScrollBarVisibility="Disabled"
HorizontalScrollMode="Enabled"
HorizontalScrollBarVisibility="Hidden"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<ListView/>
</ScrollViewer>
Any ideas?
Upvotes: 0
Views: 297
Reputation: 1241
This in your code behind should override your mouse wheel input if you assign a focus condition.
public MyView()
{
this.InitializeComponent();
Window.Current.CoreWindow.PointerWheelChanged += CoreWindow_PointerWheelChanged;
}
private void CoreWindow_PointerWheelChanged(CoreWindow sender, PointerEventArgs args)
{
if (!SomeConditionLikeYourScrollViewerIsFocused)
{
args.Handled = true;
}
else { // do nothing }
}
Upvotes: 1