Posted 7 years ago by Kasper
Version: 12.2.0571
Avatar

Hi guys,

After the latest release, I'm still a bit confused on how and when to use WindowChrome. My application allows the user to choose between all your themes, and uses the Ribbon with a RibbonWindow as the main window. Your documentation still says that I shouldn't use WindowChrome on a RibbonWindow, but I read in your latest release notes that the two should now be compatible - what's right? Also, when should I use the WindowChrome? Should I only add it when the user selects a Metro theme and then remove it again if they select a different theme, or should I use it all the time now? I'm really confused here and I can't seem to find a relevant answer in the documentation on this. Please help :)

Comments (9)

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kasper,

You can now use WindowChrome on all Windows that you want chromed, regardless of theme, since now it supports all Actipro themes.  The exception is RibbonWindow where it already has a WindowChrome built into it so applying another one to it will cause problems.  You can always get its instance (if you need it) by doing WindowChrome.GetChrome(ribbonWindow) though.


Actipro Software Support

Posted 7 years ago by Kasper
Avatar

So in my case, where I'm using a RibbonWindow, I shouldn't be using WindowChrome directly, but instead call GetChrome()? I'm sorry, but it's all a bit confusing to me. I know that I would like to use the WindowChrome instance to e.g. change the color of the statusbar, but can I always do that or is it only when using one of the Metro themes? And what about child windows, which doesn't use a RibbonWindow but just a regular Window - should I use WindowChrome on them, to make them fit with the selected theme? I really like all of these themes, but the part about the WindowChrome really confuses me, I'm afraid. I hope you can clarify things for me :)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Think of WindowChrome as a special class that attaches to a Window and manages a large number of Windows API messages so that it can achieve the custom chrome and work with Aero effects as appropriate.  You can only have one of those on a Window at a time.  RibbonWindow installs one by default.  You can get its instance of WindowChrome with the method I mentioned.  But I'm not sure why you need to get the WindowChrome instance on RibbonWindow anyhow.  You would want to apply a WindowChrome on your other non-RibbonWindow windows if you want them to be chromed.

The statusbar background is something you'd set on the StatusBar control.  So you can do that on any theme.  If you want the window border to match, only Metro themes use a similar color.  So in those themes you can update the Window.BorderBrush to match whatever brush you set as the StatusBar.Background.


Actipro Software Support

Posted 7 years ago by Kasper
Avatar

I was under the impression that if I wanted the full, new Metro look, I needed the WindowChrome class? If I don't use it, the window frame (chrome?) of my RibbonWindow looks just like any other Windows 7 application, even with a Metro theme enabled. You can see it in your own sample app, where the window looks the same even when selecting a Metro theme, while the "Metro-style Window" sample app shows what I would expect to be able to use. Perhaps I'm not understanding things correctly here, which is why my posts are a bit vague and the title asks "When to use..." :)

Question: Should I completely refrain from using the WindowChrome class within a RibbonWindow, and if so, what's the point with the WindowChrome class?

Posted 7 years ago by Josh Luth - Software Developer, Esha Research
Avatar

I was using the Metro theme as well and am disappointed to see now that I updated to the newest controls that the main chrome around my app when back to an aero theme even though I specified metro theme as the current theme. Is there a step I am missing now?

 

// Initialize ThemeManager
            ThemeManager.BeginUpdate();

            try
            {
                ThemesMetroThemeCatalogRegistrar.Register();
                ThemeManager.AreNativeThemesEnabled = false;

                ThemeManager.RegisterThemeCatalog(new TintedThemeCatalog("CustomDarkBlue", ThemeName.MetroLight.ToString(), Colors.DarkBlue));
                ThemeManager.RegisterThemeCatalog(new TintedThemeCatalog("CustomSteelBlue", ThemeName.MetroLight.ToString(), Colors.SteelBlue));
                ThemeManager.RegisterThemeCatalog(new TintedThemeCatalog("CustomDarkRed", ThemeName.MetroLight.ToString(), Colors.DarkRed));

                ThemeManager.CurrentTheme = "CustomSteelBlue";
            }
            finally
            {
                ThemeManager.EndUpdate();
            }
Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

For RibbonWindow, to keep it rendering the same as in previous versions, it will only turn glass off when in Windows 8.  Otherwise, in Windows 7, it will still use Aero glass if enabled by the O/S.  If you want it fully chromed by the internal WindowChrome always, just set RibbonWindow.IsGlassEnabled = false and that's it.  It currently defaults to null, meaning choose a value based on the operating system.

Josh, does that help with your issue?


Actipro Software Support

Posted 7 years ago by Josh Luth - Software Developer, Esha Research
Avatar

Thanks for the quick response. That fixed it for me.

Posted 6 years ago by Owen Christensen - Software Engineer, Minitab Inc.
Avatar

Apologies for resurrecting an old thread but base question is here is relevant.  We'd like to have the new Office 2013-style ribbon behavior of auto-hide and that'll require putting new buttons in the title bar. Is this a feature planned for a nearish-future release?  If not, is WindowChrome the place to go if I want to modify the TitleBar Content to put those extra buttons in the title bar?

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Owen,

We don't have that feature added to the TODO list but I will log it there as a suggestion.  To answer your other question, yes you'd want to get the WindowChrome that is already pre-installed on RibbonWindow via WindowChrome.GetChrome and then apply the titlebar content to it to add buttons.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.