ToolWindows added by Prism don't inherit Language property

Docking/MDI for WPF Forum

Posted 11 years ago by Phil Devaney
Version: 13.2.0590
Platform: .NET 4.5
Environment: Windows 7 (64-bit)

Our application supports language/locale switching on the fly when users log on or off. As part of this we set the FrameworkElement.Language property on the MainWindow, which is then inherited throughtout the visual tree.

We found a problem were the Language on all our tool windows was not being inherited but was always "en-us". Further investigation showed this was because we add the tool windows using the Prism region manager with a DockSiteRegionAdapter - a tool window added directly to the dock site in XAML behaves OK.

I've sent a sample demonstrating this to the support address

Comments (1)

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

Hi Phil,

Thanks for the sample.  The problem here seems to be based on how ItemsControls work (and DockSite mimics ItemsControl in scenarios like MVVM and Prism).  I was able to reproduce the same thing by making a simple ItemsControl like this in your sample:

public class TestItemsControl : ItemsControl {
	protected override bool IsItemItsOwnContainerOverride(object item) {
		return (item is SimpleToolWindow);
	protected override System.Windows.DependencyObject GetContainerForItemOverride() {
		return new SimpleToolWindow();

Then I put an instance of that in the window like this:


You'll see the same sort of thing occur where Language doesn't inherit down.  It must not cross the data item boundary.

As a workaround, I'd probably suggest you handle the DockSite.WindowRegistered event and in that, set up a Binding to bind the e.Window's Language property to the main window's Language property.

Actipro Software Support

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.