fluentribbon / Fluent.Ribbon

WPF Ribbon control like in Office
http://fluentribbon.github.io
MIT License
2.54k stars 518 forks source link

Add option to use legacy/office-style mouse wheel tab shifting #1058

Closed andersforsgren closed 2 years ago

andersforsgren commented 2 years ago

Closes #1055

This adds a new boolean option to use the old-style mouse wheel behavior found in Fluent.Ribbon <=v8 and Office.

The name of the new option is IsMouseWheelScrollingEnabledEverywhere, (and it's frankly not a good name...)

When true, the mouse wheel events are caught and used to cycle tabs, regardless of where on the ribbon toolbar the wheel event occurs. Wen the new option is false, the old behavior remains: mouse wheel in the tab area can cycle tab (conditional on the old IsMouseWheelScrollingEnabled option). In both cases, the same logic will potentially block the tab shifting, such as if a control has focus.

If IsMouseWheelScrollingEnabledEverywhere is true , then the value of IsMouseWheelScrollingEnabled will be ignored.

The default for the new option is false.

batzen commented 2 years ago

I did a quick test and it does not behave as office behaves. I guess there have to be more changes if this should match the office behavior.

If you want to mirror the exact behavior as in office there is more to be done. I am not sure if you want the exact same behavior as in office, though.

andersforsgren commented 2 years ago

It's not important to me that it works the same way as in office. The important part is to be able to shift tabs with Mousewheel when inside the groups at all, whether it's like Fluent.Ribbon v8.X or office. It needs to be some kind consistent and least-surprising behavior here though when it comes to group scroll/tab scroll/focus.

It's still possible to trigger group scrolling

Good catch.Will try to sort that. I think it's surprising for the user to get group scrolling only when this option is enabled + a control is focused. Better to make this option completely disable group scrolling.

Tab scrolling/shifting does not work when focus is on certain elements inside the Ribbon (buttons etc.), whereas in office it works

Ok maybe there are different behaviors also in office? I can't scroll with focus on any controls in (Tried O365 Outlook build 2207 16.0.1427).

andersforsgren commented 2 years ago

Attempted some changes here. There were two changes

1) If a dropdown popup is open, then mouse wheel events will be ignored for tab shifting and cancelled entirely (marked handled with no action) unless over the popup. This means wheel can be used to scroll in popups

2) Normally Fluent.Ribbon prevents tab shifting when a control has keyboard focus. With IsMouseWheelScrollingAllowedEverywhere, the behavior will be more aggressive and now allow it, by moving focus if necessary. Now, mouse wheel will either be handled by an open popup OR it's used to cycle ribbon tabs.

Note that potentially the check in 1) above should perhaps be made regardless of whether IsMouseWheelScrollingAllowedEverywhere is true, because the behavior otherwise is this, which feels kind of buggy

ribbon_scroll

However at the moment I have not made that change in this branch. The behavior above remains.

batzen commented 2 years ago

Will merge your changes, but i am not sure if we should stick with IsMouseWheelScrollingAllowedEverywhere. Not sure what would be a better name, but somehow i don't like it.

Also i am not sure if we should mark every mousewheel event as handled, when we didn't handle it but just want to skip our own processing. Will try to test some things and see how it behaves.

Will fix the bug you discovered regarding group scrolling.

andersforsgren commented 2 years ago

Thanks. Yes as I said the name is pretty terrible but I felt it was most important to keep it similar in prefix to the other option. If they must be renamed then I think both should be, but then they should perhaps instead be converted to a single Enum with 3 or more different modes for behavior instead of multiple booleans.