Dynamically change the language of the docking context menu

Docking/MDI for WPF Forum

Posted 11 years ago by Jürgen Schwer
Version: 13.1.0582


at the moment I try to find a solution for my docking context menu. I need to have a "hot" switch possibility for the culture. In my Application I have a combo box to change the current language. The resources should be changed on the fly. The only solution I found so far to change the strings of the context menu are these statements:


ActiproSoftware.Products.Docking.SR.SetCustomString(ActiproSoftware.Products.Docking.SRName.UICommandMakeFloatingWindowText.ToString(), "Float Translation");

ActiproSoftware.Products.Docking.SR.SetCustomString(ActiproSoftware.Products.Docking.SRName.UICommandMakeDockedWindowText.ToString(), "Dock Translation");

ActiproSoftware.Products.Docking.SR.SetCustomString(ActiproSoftware.Products.Docking.SRName.UICommandToggleWindowAutoHideStateText.ToString(), "Translation for Auto Hide");

ActiproSoftware.Products.Docking.SR.SetCustomString(ActiproSoftware.Products.Docking.SRName.UICommandCloseWindowText.ToString(), "Translation for Close");


But this only works, before the window is created. Once the context menu is created, you cannot change the entry string with these SetCustomString functions.

How can I have dynamic language support for the docking context menu?

Comments (2)

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

Hello, sorry but those particular strings are assigned when the static DockingCommands class properties are created and are passed to the RoutedUICommands that are returned by the properties.  That's why they don't update later on.

You can work around this by handling the DockSite.WindowContextMenu and updating each of the menu item's Headers based on your updated string resources.  That event fires before each context menu is displayed.

Actipro Software Support

Posted 11 years ago by Jürgen Schwer

Thank you for the work around. As I can take the RoutedUICommand.Text property as menu item ID, this solution is fine for my needs.

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.