ScrollViewer Custom Manipulation issues
Hello Noesis Devs
I'm having a bit of an issue with getting manipulations to work. Namely that "ManipulationCompleted" Never gets called no matter what i try, and i got so far by overriding the ScrollViewer's Manipulation methods. As it apparantly cancels the handle after "ManipulationStarting". Is there a way to work around this, or this just a limit of Xaml/WPF?
For More Context:
I'm trying to create smooth content scroller, that handles both manipulation on the scrollviewer as input on the content itself.
Thank you in advance,
Cornee Nieuwenhuis
I'm having a bit of an issue with getting manipulations to work. Namely that "ManipulationCompleted" Never gets called no matter what i try, and i got so far by overriding the ScrollViewer's Manipulation methods. As it apparantly cancels the handle after "ManipulationStarting". Is there a way to work around this, or this just a limit of Xaml/WPF?
For More Context:
I'm trying to create smooth content scroller, that handles both manipulation on the scrollviewer as input on the content itself.
Thank you in advance,
Cornee Nieuwenhuis
Re: ScrollViewer Custom Manipulation issues
Just a quick question, to clarify, are you able to solve this in WPF and not in Noesis or this is a common question for both.
Re: ScrollViewer Custom Manipulation issues
Can't solve it with just WPF as that doesn't give a smooth transition between Content inside the ScrollViewer.
Otherwise you could just have a "StackPanel" inside a "ScrollViewer", but this snaps instantly between content.
Otherwise you could just have a "StackPanel" inside a "ScrollViewer", but this snaps instantly between content.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: ScrollViewer Custom Manipulation issues
Hello CornNieu, maybe I'm missing something but our ScrollViewer implements by default a smooth scroll of the content when using touch, it just needs to have the PanningMode set to something different than "None", otherwise manipulations are disabled. Can you check that?
Re: ScrollViewer Custom Manipulation issues
A bit late of a reply, but unless i implemented it wrong.
But this makes the slider fully smooth, while we want it to stop per content (smoothly). Instead of it just scrolling over content smoothly
But this makes the slider fully smooth, while we want it to stop per content (smoothly). Instead of it just scrolling over content smoothly
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: ScrollViewer Custom Manipulation issues
If you are inheriting from ScrollViewer you can start by checking if IsManipulationEnabled is set to true (default ScrollViewer implementation sets it to true if PanningMode is not 'None'). This is necessary to receive manipulation events.
Then override OnManipulationStarting, set e.handled to true and indicate the e.manipulationContainer (usually the ScrollViewer itself) and the e.mode to TranslateY or what you need.
Next override OnManipulationStarted to capture the touch while dragging, and OnManipulationDelta to update the scroll info:
When inertia is started you can release the touch capture and wait until the manipulation completes.
Could you try that?
Then override OnManipulationStarting, set e.handled to true and indicate the e.manipulationContainer (usually the ScrollViewer itself) and the e.mode to TranslateY or what you need.
Next override OnManipulationStarted to capture the touch while dragging, and OnManipulationDelta to update the scroll info:
Code: Select all
IScrollInfo* scrollInfo = GetScrollInfo();
float vScroll = scrollInfo->GetVerticalOffset();
scrollInfo->SetVerticalOffset(vOffset - e.deltaManipulation.translation.y * GetPanningRatio());
Could you try that?
Re: ScrollViewer Custom Manipulation issues
Thank you for the Reply!
I have tried this but unfortunatly the "GetScrollInfo" method is inaccesible to the inherited class.
Everything else seems to be fine. The same happens as before, can't set the offset.
I have tried this but unfortunatly the "GetScrollInfo" method is inaccesible to the inherited class.
Everything else seems to be fine. The same happens as before, can't set the offset.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: ScrollViewer Custom Manipulation issues
ScrollViewer defines the GetScrollInfo() method as protected, so inheritors can use it. Aren't you inheriting from the ScrollViewer class?
Re: ScrollViewer Custom Manipulation issues
Hmm, strange. Has there been an update that changes it to protected, as we are working on quite an older version of noesis
Re: ScrollViewer Custom Manipulation issues
It indeed seems to be moved to protected on update 3.1.1, so we'll be looking into updating.
So i'll come back to this whenever we get the time to update Noesis.
So i'll come back to this whenever we get the time to update Noesis.
Who is online
Users browsing this forum: Ahrefs [Bot] and 61 guests