AutoHideLeftContainers Issue

Docking/MDI for WPF Forum

Posted 11 years ago by Harry Nystrom
Version: 12.2.0571
Platform: .NET 4.0
Environment: Windows 7 (32-bit)
Avatar

I am trying to implement two tool windows within a auto hide left structure.  I patterned what I did after one of your samples.

Here is the XAML from your sample:

<docking:DockSite.AutoHideLeftContainers>

<docking:ToolWindowContainer>

<docking:ToolWindow x:Name="toolboxToolWindow" Title="Toolbox" ImageSource="/Resources/Images/Toolbox16.png">

<TextBlock Margin="3" Text="Place toolbox items here." />

</docking:ToolWindow>

</docking:ToolWindowContainer>

<docking:ToolWindowContainer>

<docking:ToolWindow x:Name="toolWindowDockingToolWindow" Title="Tool Window Docking" ImageSource="/Resources/Images/Properties16.png">

<Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">

<ScrollViewer VerticalScrollBarVisibility="Auto">

<StackPanel Margin="7">

<TextBlock Text="Tool Windows (Open in bold):" TextWrapping="Wrap" />

<ListBox x:Name="toolWindowsListBox" Margin="0,3,0,0" Height="150" ItemsSource="{Binding ElementName=dockSite, Path=ToolWindows}" SelectedIndex="0">

<ListBox.ItemTemplate>

<DataTemplate DataType="docking:ToolWindow">

<TextBlock x:Name="title" Text="{Binding Title}" />

<DataTemplate.Triggers>

<DataTrigger Binding="{Binding IsOpen}" Value="True">

<Setter TargetName="title" Property="FontWeight" Value="Bold" />

</DataTrigger>

</DataTemplate.Triggers>

</DataTemplate>

</ListBox.ItemTemplate>

</ListBox>

<TextBlock Margin="0,7,0,0" Text="Actions affect selected tool window in list above:" TextWrapping="Wrap" />

<WrapPanel Margin="0,3,0,0">

<Button Content="Activate" Command="docking:DockingCommands.ActivateWindow"

CommandTarget="{Binding ElementName=toolWindowsListBox, Path=SelectedItem}" />

<Button Content="Open" Command="docking:DockingCommands.OpenWindow"

CommandTarget="{Binding ElementName=toolWindowsListBox, Path=SelectedItem}" />

<Button Content="Close" Command="docking:DockingCommands.CloseWindow"

CommandTarget="{Binding ElementName=toolWindowsListBox, Path=SelectedItem}" />

<Button Content="Destroy" Click="OnDestroyToolWindowButtonClick" />

</WrapPanel>

<WrapPanel Margin="0,3,0,0">

<TextBlock Text="Direction " VerticalAlignment="Center" />

<ComboBox x:Name="programmaticDockDirectionComboBox" SelectedIndex="3"

ItemsSource="{Binding Source={StaticResource DirectionObjectDataProvider}}" />

<Button Content="Dock to DockSite" Click="OnProgrammaticDockToDockSiteButtonClick" />

<Button Content="Dock to Solution Explorer" Click="OnProgrammaticDockToSolutionExplorerButtonClick" />

</WrapPanel>

<GroupBox Header="Float" Margin="0,7,0,0" Padding="3,2,3,0">

<Grid>

<Grid.RowDefinitions>

<RowDefinition Height="Auto" />

<RowDefinition Height="3" />

<RowDefinition Height="Auto" />

<RowDefinition Height="3" />

<RowDefinition Height="Auto" />

<RowDefinition Height="3" />

<RowDefinition Height="Auto" />

</Grid.RowDefinitions>

<Grid.ColumnDefinitions>

<ColumnDefinition Width="Auto" />

<ColumnDefinition Width="3" />

<ColumnDefinition Width="*" />

</Grid.ColumnDefinitions>

<TextBlock Text="Position:" HorizontalAlignment="Right" VerticalAlignment="Center" />

<editors:PointEditBox x:Name="floatPositionEditBox" Grid.Column="2"

CheckBoxVisibility="Visible" InitialValue="100,100" />

<TextBlock Text="Size:" Grid.Row="2" HorizontalAlignment="Right"

VerticalAlignment="Center" />

<editors:SizeEditBox x:Name="floatSizeEditBox" Grid.Row="2" Grid.Column="2"

CheckBoxVisibility="Visible" InitialValue="200, 300" />

<TextBlock Text="Behavior:" Grid.Row="4" HorizontalAlignment="Right"

VerticalAlignment="Center" />

<ComboBox x:Name="floatSizingBehaviorComboBox" Grid.Row="4" Grid.Column="2"

SelectedIndex="0"

ItemsSource="{Binding Source={StaticResource FloatSizingBehaviorObjectDataProvider}}" />

<Button Grid.Row="6" Grid.ColumnSpan="3" HorizontalAlignment="Right"

Content="Float" Click="OnFloatToolWindowButtonClick" />

</Grid>

</GroupBox>

</StackPanel>

</ScrollViewer>

</Border>

</docking:ToolWindow>

</docking:ToolWindowContainer>

</docking:DockSite.AutoHideLeftContainers>

 

Here is the XAML from my application:

 

<docking:DockSite.AutoHideLeftContainers>

<docking:ToolWindowContainer x:Name="DataAcquisitionToolWindowContainer" docking:DockSite.ControlSize="750,600">

<docking:ToolWindow x:Name="InstrumentControlToolWindow" Background="{DynamicResource FixedPanelBackground}"

Title="{x:Static properties:Resources.InstrumentControlTitle}" Style="{DynamicResource ToolWindowStyle}">

<views:InstrumentControlView x:Name="InstrumentControlView"/>

</docking:ToolWindow>

</docking:ToolWindowContainer>

<docking:ToolWindowContainer docking:DockSite.ControlSize="750,600">

<docking:ToolWindow x:Name="LiveDataWindow" Title="{x:Static properties:Resources.LiveData}" Style="{DynamicResource ToolWindowStyle}">

<views:LiveDataView x:Name="LiveDataView"/>

</docking:ToolWindow>

</docking:ToolWindowContainer>

</docking:DockSite.AutoHideLeftContainers>

 

As you can see, both have two tool windows within the container.  When I start the application, both tool windows show up as collapsed on the left side, as they should according to my understanding.  The problem I am having is as follows:  If I "unhide" and pin both windows and then unpin them, the one on the right gets "hidden" on the right side instead of on the left side.  Is there anything special I have to do to get this window to "rehide" properly back on the left side?

Thanks.

Comments (8)

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

Hi Harry,

In the future, please don't paste large code snippets in the forum as they are hard to read and we can't really debug anything with them.  Instead please make a new simple sample project that just shows the issue and e-mail it to our support address.  Rename the .zip file extension so it doesn't get spam blocked.

In general the auto-hide side is determined by the relative position of the docked window at the time it is auto-hidden.  You may be able to improve your particular scenario if you include both ToolWindows in the same ToolWindowContainer at the start, instead of separate ones.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

When I try what you are suggesting, the results are even stranger.  Regardless of which ToolWindow I pick, when I pin it, it takes up the entire DockSite.  Both ToolWindows then "appear" as separate tabs whose headers are at the bottom of the DockSite container.  I can switch back and forth between the two, but cannot view each separately.  When I try to tear one of them away from the DockSite container, they both end up being torn off as a single "unit."  This is the reason why I put them in separate ToolWindowContainers.  In the latter case, the actual behavior is at least closer to the expected behavior.

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

Well your DockSite doesn't have a Workspace in it.  Thus the docked tool windows will enter tool window inner fill mode (fill the DockSite) since there is nothing for them to dock around.  If you add a Workspace, that will make them dock just to a side of the workspace.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

I tried what you described.  However, before I tell you what happened, it's worth pointing out that the XAML in MainWindow.xaml and that in MainControl.xaml of your sample entitled SampleApplication-CSharp do not specify a Workspace.

My solution would not build or run when I tried implementing a workspace.  I tried both putting the AutoHideLeftContainer inside the workspace and putting the WorkSpace inside the AutoHideLeftContainer.  When I tried the former, I got the error "DockSite.AutoHideLeftContainers is not defined on Workspace.  When I tried the latter, the solution did build.  However, when I ran the application, I got a XamlParseException:  The value Docking.Workspace is not of type Docking.ToolWindowContainer.

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

Actually nearly all our samples (including the main Features demo) have Workspaces in them.  A sample that is relatively simple and a good one to look at is the FixedToolWindow one.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

I looked at the MainWindow.xaml file in the FixedToolWindow folder of the sample.  There is a ToolWindowContainer inside a AutoHideLeftContainers "block."  However, it is not within a Workspace, nor does it contain a Workspace.  The Workspace in that example is defined later as part of a SplitContainer.

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

Sorry, I think you misunderstand what I'm saying.  The DockSite or one of its nested SplitContainers needs a Workspace so that docked tool windows know what to dock "around".  You wouldn't put a Workspace in anything but a DockSite or SplitContainer, depending on your layout.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

I was able to get things to work properly by defining a "blank" Workspace immediately following the AutoHideLeftContainer.  However, I did have to put each ToolWindow in a separate ToolWindowContainer.  Thanks for your help.

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

Add Comment

Please log in to a validated account to post comments.