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

RibbonGroupBox should resize when font family or size are changed #552

Closed
chrfin opened this issue Mar 29, 2018 · 2 comments
Closed

RibbonGroupBox should resize when font family or size are changed #552

chrfin opened this issue Mar 29, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@chrfin
Copy link
Contributor

chrfin commented Mar 29, 2018

This is in relation to #551:
After I change the font size the ribbon does not automatically "re-arrange" the items and it looks the following - again crazy example to make it obvious:
image
If you then somehow trigger a "redraw", e.g. by changing the window size just 1px it is correct again:
image

To fix this "by code" I did the following (window is our window which inherits RibbonWindow and has a Ribbon property which grants access to the actual ribbon control):
Until yesterday we targeted .NET 4.6.1 and the following worked:

window.UpdateLayout();
window.Ribbon.Measure(new Size(window.Ribbon.ActualWidth, window.Ribbon.ActualHeight));

Then we updated to target .NET 4.7.1 and it got stuck on the Measure call, but the following does work now:

window.Ribbon.UpdateLayout();
window.Ribbon.OnApplyTemplate();

Is this the correct way to do this or is there a better way?

@batzen
Copy link
Member

batzen commented Mar 30, 2018

Forcing the template to be applied again might cause issues.
You will face a lot of issues when trying to fully allow dynamic font sizes.
Why don't you simply add zooming to your application? That way icons also get larger etc.

I will have a look at how to improve the situation out of the box as it should manly be caused by caching measures for RibbonGroupBox and it's children.

@chrfin
Copy link
Contributor Author

chrfin commented Mar 30, 2018

It's not a use case, that the font-size is "fully dynamic" or changed "all the time" it's more or less a "one time setting" and we just want to allow our customers to change them in some degree (the extreme examples I postet where just for testing) as we had some requests from customers and it was a "nice by-product" of the themes we just implemented and aside from these two issues it worked "out of the box".
But "zooming" is also a good (additional) idea - especially when using our software in a presentation via a projector.
Very likely the font(-size) options will become only a hidden feature we just change for customers "on request" to avoid "glitches", but non the less it should basically work IMO...

Thanks for looking into it!

@batzen batzen changed the title How to update control arrangement after size change? RibbonGroupBox should resize when font family or size are changed Apr 1, 2018
@batzen batzen closed this as completed in f908b60 Apr 1, 2018
@batzen batzen added this to the 7.0.0 milestone Apr 2, 2018
@batzen batzen added the Bug 🐞 label Apr 2, 2018
@batzen batzen self-assigned this Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants