Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There should be an option to disable animations in the whole control #194

Closed
floele-ww opened this issue Nov 5, 2015 · 12 comments
Closed
Assignees
Milestone

Comments

@floele-ww
Copy link
Contributor

Animations in WPF unfortunately don't work well on many systems and introduce a notiable slowdown when using menu items, dropdown buttons or the backstage menu.
Currently, you have to manually edit all XAML files in Fluent and create a custom version of the control just to disable animations. Much better for maintainability would be a property in the Ribbon or RibbonWindow class to disable animations across the whole control.

@batzen
Copy link
Member

batzen commented Nov 6, 2015

Any suggestions on how to achieve this?

@floele
Copy link
Contributor

floele commented Nov 8, 2015

I could imagine a property in the Ribbon class, maybe called "MenuAnimationStyle", which allows setting any value of an enum {Default,None,BackstageOnly). Then you could bind all PopupAnimation properties in the XAML file like this:

PopupAnimation="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:Ribbon}}, Path=MenuAnimationStyle, Mode=OneWay, Converter={animationStyleConverter}, ConverterParameter=Fade}"

Where ConverterParameter specifies the animation to use if MenuAnimationStyle=Default, so that each theme can still have its own default animation.

For the backstage menu we could then adjust the ControlTemplate triggers to only set the margins or use a different animation without duration maybe.

I can also try and make these code changes if you agree with my suggestion.

@batzen
Copy link
Member

batzen commented Nov 9, 2015

Let me think about this for a few days.

@batzen
Copy link
Member

batzen commented Dec 1, 2015

Sorry for the delay. I don't have to work from 18.12.2015 till 18.01.2016, so I will implement this then.
I guess it would also make sense to disable animations automatically when a remote desktop session is established and animations are disabled in the remote desktop session settings.

@batzen batzen self-assigned this Dec 1, 2015
@batzen batzen added this to the 4.1.0 milestone Dec 1, 2015
@floele-ww
Copy link
Contributor Author

Yes, that would make sense. Animations in RDP can be particularly annoying.
Thanks!

@batzen batzen modified the milestones: 4.0.0, 4.1.0 Dec 18, 2015
@batzen
Copy link
Member

batzen commented Dec 20, 2015

To solve this issue I was thinking about using MenuPopupAnimation and ComboBoxPopupAnimation from SystemParameters for "regular" controls.
For the backstage I could use ClientAreaAnimation from SystemParameters.

The only drawback for "regular" controls would be that the PopupAnimation would be the same for all themes across the ribbon.
I don't know what people would think about that drawback.

And I still have to test if it really works.
Edit: It does work as expected.

@floele-ww
Copy link
Contributor Author

If overriding the animation like this http://stackoverflow.com/questions/3160467/how-to-disable-wpf-contextmenu-animations works fine, I think the solution is reasonable.
I don't see any reason for themes having different menu animations in the first place, so I don't consider the "global" setting a problem. I guess some theme designers should comment on this ;)

@batzen batzen closed this as completed in 90efb7e Dec 21, 2015
@batzen
Copy link
Member

batzen commented Dec 21, 2015

As I am the designer I decide that no one needs different default animations. ;-)
Overwriting should work exactly as described in your linked stackoverflow post.

@floele-ww
Copy link
Contributor Author

Great, thanks 👍

@floele-ww
Copy link
Contributor Author

I noticed one issue that is still present in the current version. Not sure if you want to re-open or use this issue. The problem is that ComboBoxPopupAnimationKey=None does not work on sub menus. So if you open a drop down button menu, no animation is used, but if one of the items has a sub menu, it's animated again.

@batzen
Copy link
Member

batzen commented Sep 19, 2016

How about MenuPopupAnimationKey?

@floele-ww
Copy link
Contributor Author

Yep, overriding both of these seems to work fine, thanks. I just wonder why I didn't set both of these options in the first place, seems kind of obvious actually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants