AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.45k stars 2.21k forks source link

The pointer wheel event is handled differently for different controls #6869

Closed timunie closed 2 years ago

timunie commented 2 years ago

Describe the bug To be honest I don't know if this is really a bug or intended by design. Maybe I am completely wrong here. if so, feel free to close this issue.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://github.com/timunie/Tims.Avalonia.Samples/tree/main/src/ScrollingIssueSample
  2. Download and build the source
  3. scroll around and notice the different behavior for different controls
  4. move the focus to different controls and scroll again, Notice the different behavior for different controls

Expected behavior IMO the pointer wheel should be handled the same way for similar controls, for example:

Screenshots Just a capture of the provided demo. Feel free to change the demo to your needs. ScrollingDemo

Desktop (please complete the following information):

Additional context See also #6579 and #6762

/cc @grokys @maxkatz6

Happy coding Tim

grokys commented 2 years ago

Good observations!

ButtonSpinner ignores if the control has focus or not

Yep, that's wrong. Should be fixed.

CalendarControl scrolls months

Undecided on this one. From what I can see even the calendar in the Windows taskbar has this behavior.

ListBox doesn't scroll the outer scroll when end is reached (erroneously marked as DataGrid in your sample app)

I'm surprised that DataGrid gets this one right when ListBox doesn't! This needs to be fixed.

timunie commented 2 years ago

Hey @grokys

I investigated this further and saw that my internet browser does the scrolling like this: If any nested ScrollViewer reaches the end in any direction the scroll event gets bubbled up to the parent ScrollViewer. In WPF this is not the case. In WPF the behavior is more like the one we observe in the ListBox. I personally prefer the way the internet browser does it, but that may not be how others like it. Therefore I think a DirectProperty or AttachedProperty for the ScrollViewer which can be opt in or opt out, just like it is needed in the given context.

I will do some tests and provide a PR as a proposal.

Happy coding

Tim

timunie commented 2 years ago

Hey @grokys

I made a draft PR to fix the issue. May I ask you to have a look if you find the time and give me a feedback?

Thank you Tim