Close, Maximize, Restore Tool Tips

Ribbon for WPF Forum

Posted 16 years ago by Eric Crump
Version: 4.0.0457
Avatar
I have successfuly change all the other text in the ribbon using the keys found in the string resource browser. However, when I set the values for the title bar buttons, nothing changes.


ActiproSoftware.Products.Ribbon.SR.SetCustomString("UIRibbonWindowTitleBarButtonCloseToolTip", "blah");
ActiproSoftware.Products.Ribbon.SR.SetCustomString("UIRibbonWindowTitleBarButtonMaximizeToolTip", "blah");
ActiproSoftware.Products.Ribbon.SR.SetCustomString("UIRibbonWindowTitleBarButtonMinimizeToolTip", "blah"));
ActiproSoftware.Products.Ribbon.SR.SetCustomString("UIRibbonWindowTitleBarButtonRestoreToolTip", "blah"))

help?

Comments (11)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I just tested it here and it worked ok. Be sure you place those statements before ANY UI is loaded. Ideally you place it in your application object's startup code before a Window is opened. Because if the RibbonWindow style is loaded and applied before you set those, the update will not take place.


Actipro Software Support

Posted 16 years ago by Eric Crump
Avatar
My application changes languages on the fly without a restart. The rest of the ribbon cooperates. So the control buttons are special and I won't be able to change them?
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The text is applied in the XAML template for RibbonWindow via our SRExtension. What happens if you apply a different style like by perhaps switching themes? Does it update then?


Actipro Software Support

Posted 16 years ago by Eric Crump
Avatar
How do I switch the theme? I tried this:

ActiproSoftware.Windows.Themes.ThemeManager.CurrentTheme = "Office2007Black";

but it had no effect. I can change the theme in XAML before the application loads, but in code it isn't working.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
That will work however my guess is that you also set the theme explicitly in XAML, which will prevent the CurrentTheme from changing anything.

Setting themes in XAML should only generally be done for testing purposes, since you have more app-wide control if you only use ThemeManager.CurrentTheme.


Actipro Software Support

Posted 16 years ago by Eric Crump
Avatar
OK, I got the theme to change, but it doesn't change the tool tips. It doesn't change when the app first starts or when you change it after the window is open.

This method is called both right after InitializeComponent() and after you change the language once the app starts. I tried using different themese also. Again, only the last four don't work.

public void SetRibbonTextForLanguage()
        {
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeMenuItemMinimizeRibbonText", LanguageController.Instance.GetString("RibbonMenuItemMinimizeRibbonText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeMenuItemCustomizeQatText", LanguageController.Instance.GetString("RibbonMenuItemCustomizeQatText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeMenuItemAddToQatText", LanguageController.Instance.GetString("RibbonMenuItemAddToQatText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeMenuItemRemoveFromQatText", LanguageController.Instance.GetString("RibbonMenuItemRemoveFromQatText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeMenuItemShowQatAboveRibbonText", LanguageController.Instance.GetString("RibbonMenuItemShowQatAboveRibbonText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeMenuItemShowQatBelowRibbonText", LanguageController.Instance.GetString("RibbonMenuItemShowQatBelowRibbonText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeMenuItemShowAboveRibbonText", LanguageController.Instance.GetString("RibbonMenuItemShowAboveRibbonText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeMenuItemShowBelowRibbonText", LanguageController.Instance.GetString("RibbonMenuItemShowBelowRibbonText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UICustomizeQatMenuHeaderText", LanguageController.Instance.GetString("RibbonQatMenuHeaderText"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UIRibbonWindowTitleBarButtonCloseToolTip", LanguageController.Instance.GetString("RibbonClose"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UIRibbonWindowTitleBarButtonMaximizeToolTip", LanguageController.Instance.GetString("RibbonMaximize"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UIRibbonWindowTitleBarButtonMinimizeToolTip", LanguageController.Instance.GetString("RibbonMinimize"));
            ActiproSoftware.Products.Ribbon.SR.SetCustomString("UIRibbonWindowTitleBarButtonRestoreToolTip", LanguageController.Instance.GetString("RibbonRestore"));

            ActiproSoftware.Windows.Themes.ThemeManager.CurrentTheme = "Office2007Blue";
        }        
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You have to set it BEFORE any UI is loaded, this means call it in your application startup code (not in a window) or BEFORE InitializeComponent is called. That should handle the first case.

For the second one after language is changed, maybe try changing it to a different theme and then setting it back. If that works then we know the styles are reloaded later. If not, then the XAML in the styles are being initialized once, the first time they are loaded.


Actipro Software Support

Posted 16 years ago by Eric Crump
Avatar

public App()
{
     ActiproSoftware.Windows.Themes.ThemeManager.CurrentTheme = "Office2007Blue";
     ...
}
Same result. Pardon my ignorance, but am I still in the wrong place?

I tried the switching and switching back thing before, no go.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You have to set the custom UI strings before any sort of UI is loaded. So setting the theme before setting the custom UI strings (which I assume is what you are doing above) is not going to work. You need to flip that around.

That will handle the initial case, however per your other comment, there will still be a problem when the user switches languages on the fly since the theme change didn't reinitialize anything. We'll have to think about if there's anything we can do there. Do you happen to have a list of which particular strings are not changing (that you have seen) when changing on the fly later? Is it just the title bar buttons?


Actipro Software Support

Posted 16 years ago by Eric Crump
Avatar
Those bar buttons are the only ones. I've been able to change everything else in the ribbon/window.
Posted 16 years ago by Eric Crump
Avatar
OK, that was a stupid mistake on my part, got it to work for the initial start up.
The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.