User avatar
CornNieu
Topic Author
Posts: 11
Joined: 24 Oct 2022, 15:58
Location: Sweden, Falun
Contact:

ScrollViewer Custom Manipulation issues

05 Dec 2022, 15:42

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
 
User avatar
jsantos
Site Admin
Posts: 3992
Joined: 20 Jan 2012, 17:18
Contact:

Re: ScrollViewer Custom Manipulation issues

07 Dec 2022, 01:42

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.
 
User avatar
CornNieu
Topic Author
Posts: 11
Joined: 24 Oct 2022, 15:58
Location: Sweden, Falun
Contact:

Re: ScrollViewer Custom Manipulation issues

07 Dec 2022, 16:27

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.
 
User avatar
sfernandez
Site Admin
Posts: 3064
Joined: 22 Dec 2011, 19:20

Re: ScrollViewer Custom Manipulation issues

12 Dec 2022, 18:31

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?
 
User avatar
CornNieu
Topic Author
Posts: 11
Joined: 24 Oct 2022, 15:58
Location: Sweden, Falun
Contact:

Re: ScrollViewer Custom Manipulation issues

22 Dec 2022, 16:13

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
 
User avatar
sfernandez
Site Admin
Posts: 3064
Joined: 22 Dec 2011, 19:20

Re: ScrollViewer Custom Manipulation issues

05 Jan 2023, 14:04

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:
IScrollInfo* scrollInfo = GetScrollInfo();
float vScroll = scrollInfo->GetVerticalOffset();
scrollInfo->SetVerticalOffset(vOffset - e.deltaManipulation.translation.y * GetPanningRatio());
When inertia is started you can release the touch capture and wait until the manipulation completes.

Could you try that?
 
User avatar
CornNieu
Topic Author
Posts: 11
Joined: 24 Oct 2022, 15:58
Location: Sweden, Falun
Contact:

Re: ScrollViewer Custom Manipulation issues

10 Jan 2023, 14:31

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.
 
User avatar
sfernandez
Site Admin
Posts: 3064
Joined: 22 Dec 2011, 19:20

Re: ScrollViewer Custom Manipulation issues

10 Jan 2023, 18:19

ScrollViewer defines the GetScrollInfo() method as protected, so inheritors can use it. Aren't you inheriting from the ScrollViewer class?
 
User avatar
CornNieu
Topic Author
Posts: 11
Joined: 24 Oct 2022, 15:58
Location: Sweden, Falun
Contact:

Re: ScrollViewer Custom Manipulation issues

11 Jan 2023, 10:00

Hmm, strange. Has there been an update that changes it to protected, as we are working on quite an older version of noesis
 
User avatar
CornNieu
Topic Author
Posts: 11
Joined: 24 Oct 2022, 15:58
Location: Sweden, Falun
Contact:

Re: ScrollViewer Custom Manipulation issues

11 Jan 2023, 12:23

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.

Who is online

Users browsing this forum: Rmunoz and 2 guests