How I can use DockSite.Workspace with TabbedMdiHost and without it.

Docking/MDI for WPF Forum

Posted 7 months ago by Denys
Version: 23.1.4
Avatar

Hi
I'd like to use DockSite in the following way.

When there are documents, I show TabbedMdiHost and DockSite works as usual. And when there are no documents, I need to show my Workspace (for example with logo) without TabbedMdiHost.

I have tried to do it this way and also made different variants with Workspace:

<docking:DockSite DocumentItemsSource="{Binding Documents}"
                  ToolItemsSource="{Binding Tools}"
                  CanDocumentWindowsFloat="True"
                  AreDocumentWindowsDestroyedOnClose="False"
                  AreNewTabsInsertedBeforeExistingTabs="False"
                  DocumentItemContainerStyle="{StaticResource DocumentWindowStyle}"
                  ToolItemContainerStyle="{StaticResource ToolWindowStyle}">
    <docking:DockSite.Style>
        <Style TargetType="{x:Type docking:DockSite}">
            <Setter Property="Child">
                <Setter.Value>
                    <docking:Workspace>
                        <docking:TabbedMdiHost HasTabPinButtons="False" CanDocumentTabsDrag="True"/>
                    </docking:Workspace>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding HasDocuments}" Value="False">
                    <Setter Property="Child">
                        <Setter.Value>
                            <docking:Workspace>
                                <Viewbox Margin="10" MaxWidth="400" Stretch="Uniform">
                                    <shared:ActiproLogo/>
                                </Viewbox>
                            </docking:Workspace>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </docking:DockSite.Style>
</docking:DockSite>

where:

  • xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
  • xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"

DocumentWindowStyle, ToolWindowStyle - are not important in this case, they can be anything.

But the logo doesn't show up.

Thank you.

[Modified 7 months ago]

Comments (2)

Answer - Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You don't want to dynamically assign the DockSite.Child like that since it will corrupt the layout later on if there are tool windows.

Instead, we actually have a feature specifically for showing content like a logo when there are no documents open.  Please see this documentation topic for details.


Actipro Software Support

Posted 7 months ago by Denys
Avatar

Thank you

It works for me.

<docking:Workspace>
    <docking:TabbedMdiHost HasTabPinButtons="False" CanDocumentTabsDrag="True"
                           EmptyContent="{Binding .}">
        <docking:TabbedMdiHost.EmptyContentTemplate>
            <DataTemplate DataType="{x:Type viewModels:IDockingContentViewModel}">
                <Viewbox x:Name="ViewBox" Margin="10" MaxWidth="400" Stretch="Uniform" Visibility="Collapsed">
                    <shared:ActiproLogo/>
                </Viewbox>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding Documents}" Value="{x:Null}">
                        <Setter TargetName="ViewBox" Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Documents.Count}" Value="0">
                        <Setter TargetName="ViewBox" Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </docking:TabbedMdiHost.EmptyContentTemplate>
    </docking:TabbedMdiHost>
</docking:Workspace>
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.