We're developing an application where the user is able to switch between different layouts, much like in Eclipse. I've managed to get the switching working adequately, but whenever I set a layout that is similar to the previous one, I end up with two tabs being selected (in both of the ToolWindowContainers that we currently have); the one that's supposed to be selected and the last/rightmost one. This only occurs if these containers and their tabs are visible in both layouts.
The last tabs' content is not visible, though, and they can't be activated unless I click on one of the currently not selected tabs first. In the container where we have only two tool windows, this is particularly problematic as there are no tabs that are not selected. To get around the problem there, I have to first drag the tab out of the container and back.
Here's the XAML code (slightly simplified and things have been given neutral names).
<docking:DockSite Name="mainDockSite">
<docking:SplitContainer>
<docking:ToolWindowContainer>
<docking:ToolWindow x:Name="toolWindow1">
<...>
</docking:ToolWindow>
</docking:ToolWindowContainer>
<docking:SplitContainer Orientation="Horizontal">
<docking:SplitContainer Orientation="Vertical">
<docking:Workspace>
<docking:TabbedMdiHost x:Name="tabbedMdiHost">
<docking:DocumentWindow IsOpen="False" />
</docking:TabbedMdiContainer>
</docking:TabbedMdiHost>
</docking:Workspace>
<docking:ToolWindowContainer>
<docking:ToolWindow x:Name="toolWindow2">
<...>
</docking:ToolWindow>
<docking:ToolWindow x:Name="toolWindow3">
<...>
</docking:ToolWindow>
<docking:ToolWindow x:Name="toolWindow4">
<...>
</docking:ToolWindow>
<docking:ToolWindow x:Name="toolWindow5">
<...>
</docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:SplitContainer>
<docking:SplitContainer Orientation="Vertical">
<docking:ToolWindowContainer>
<docking:ToolWindow x:Name="toolWindow6">
<...>
</docking:ToolWindow>
</docking:ToolWindowContainer>
<docking:ToolWindowContainer>
<docking:ToolWindow x:Name="toolWindow7">
<...>
</docking:ToolWindow>
<docking:ToolWindow x:Name="toolWindow8">
<...>
</docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:SplitContainer>
</docking:SplitContainer>
</docking:SplitContainer>
</docking:DockSite>
This is what I get in the output when this occurs:
System.Windows.Data Error: 40 : BindingExpression path error: 'HasTitleBarResolved' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.HasTitleBarResolved; DataItem='ToolWindowContainer' (Name=''); target element is 'Border' (Name='titleBarBorder'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'CanCloseResolved' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.CanCloseResolved; DataItem='ToolWindowContainer' (Name=''); target element is 'Button' (Name='closeButton'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'CanAutoHideResolved' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.CanAutoHideResolved; DataItem='ToolWindowContainer' (Name=''); target element is 'Button' (Name='autoHideButton'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'HasOptionsResolved' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.HasOptionsResolved; DataItem='ToolWindowContainer' (Name=''); target element is 'PopupButton' (Name='optionsButton'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'Title' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.Title; DataItem='ToolWindowContainer' (Name=''); target element is 'TextBlock' (Name='title'); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'ContextImageSource' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.ContextImageSource; DataItem='ToolWindowContainer' (Name=''); target element is 'Image' (Name='contextImage'); target property is 'Source' (type 'ImageSource')
System.Windows.Data Error: 40 : BindingExpression path error: 'BorderThickness' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.BorderThickness; DataItem='ToolWindowContainer' (Name=''); target element is 'Border' (Name=''); target property is 'BorderThickness' (type 'Thickness')
System.Windows.Data Error: 40 : BindingExpression path error: 'BorderBrush' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.BorderBrush; DataItem='ToolWindowContainer' (Name=''); target element is 'Border' (Name=''); target property is 'BorderBrush' (type 'Brush')
System.Windows.Data Error: 40 : BindingExpression path error: 'Background' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.Background; DataItem='ToolWindowContainer' (Name=''); target element is 'Border' (Name=''); target property is 'Background' (type 'Brush')
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=Content; DataItem='#Hi' (Name=''); target element is 'ToolWindowContainer' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'HasTitleBarResolved' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.HasTitleBarResolved; DataItem='ToolWindowContainer' (Name=''); target element is 'Border' (Name='titleBarBorder'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'CanCloseResolved' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.CanCloseResolved; DataItem='ToolWindowContainer' (Name=''); target element is 'Button' (Name='closeButton'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'CanAutoHideResolved' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.CanAutoHideResolved; DataItem='ToolWindowContainer' (Name=''); target element is 'Button' (Name='autoHideButton'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'HasOptionsResolved' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.HasOptionsResolved; DataItem='ToolWindowContainer' (Name=''); target element is 'PopupButton' (Name='optionsButton'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'Title' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.Title; DataItem='ToolWindowContainer' (Name=''); target element is 'TextBlock' (Name='title'); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'ContextImageSource' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.ContextImageSource; DataItem='ToolWindowContainer' (Name=''); target element is 'Image' (Name='contextImage'); target property is 'Source' (type 'ImageSource')
System.Windows.Data Error: 40 : BindingExpression path error: 'BorderThickness' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.BorderThickness; DataItem='ToolWindowContainer' (Name=''); target element is 'Border' (Name=''); target property is 'BorderThickness' (type 'Thickness')
System.Windows.Data Error: 40 : BindingExpression path error: 'BorderBrush' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.BorderBrush; DataItem='ToolWindowContainer' (Name=''); target element is 'Border' (Name=''); target property is 'BorderBrush' (type 'Brush')
System.Windows.Data Error: 40 : BindingExpression path error: 'Background' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=SelectedItem.Background; DataItem='ToolWindowContainer' (Name=''); target element is 'Border' (Name=''); target property is 'Background' (type 'Brush')
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''#Hi' (Name='')'. BindingExpression:Path=Content; DataItem='#Hi' (Name=''); target element is 'ToolWindowContainer' (Name=''); target property is 'NoTarget' (type 'Object')
"Hi" to you too!
Still seems to be an issue in 2012.2 build 0570.