How can I remove margin around a document tab's content?

Docking/MDI for WPF Forum

Posted 11 years ago by Craig - Varigence, Inc.
Version: 12.2.0573
Avatar

Background:

Im working on a WPF application that uses the Docking and SyntaxEditor controls. I'm seeing an odd behavior where, when I add a SyntaxEditor within a document tab, the syntax editor has a 5 pixel border between it and the document tab's edges. 

I believe this margin comes from Docking\Themes\Includes\Styles\AutoHide.xaml, in the {x:Type dockingPrimitives:AutoHideHost} style, since its Padding property is set to 5, which is then bound to the PART_ContentArea's Margin.

Questions:

  1. Is there a way I can set the margin to 0, without having to author my own style?
  2. If I remove the margin, is there anything I need to bear in mind? For instance, does removing it cause other tool windows to bump up against each other? Does the margin serve some other purpose that I'm not realizing?

Code Sample:

<Window 
    x:Class="ActiproSyntaxEditorMarginBug.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
    xmlns:syntaxeditor="http://schemas.actiprosoftware.com/winfx/xaml/syntaxeditor"
    Title="MainWindow" 
    Height="350" 
    Width="525"
    >
    <Grid>
        <docking:DockSite
            AreDocumentWindowsDestroyedOnClose="False"
            CanDocumentWindowsRaft="True"
            >
            <docking:DockSite.Content>
                <docking:SplitContainer>
                    <docking:SplitContainer
                        Orientation="Vertical"
                        >
                        <docking:Workspace>
                            <docking:TabbedMdiHost>
                                <docking:TabbedMdiContainer>
                                    <docking:DocumentWindow
                                        Title="Syntax Editor"
                                        >
                                        <docking:DockSite>
                                            <docking:SplitContainer
                                                Orientation="Vertical"
                                                >
                                                <docking:Workspace>
                                                    <syntaxeditor:SyntaxEditor
                                                        />
                                                </docking:Workspace>
                                                <docking:ToolWindowContainer>
                                                    <docking:ToolWindow
                                                        CanClose="True"
                                                        Title="Syntax Editor Tool Window"
                                                        IsOpen="False"
                                                        />
                                                </docking:ToolWindowContainer>
                                            </docking:SplitContainer>
                                        </docking:DockSite>
                                    </docking:DocumentWindow>
                                </docking:TabbedMdiContainer>
                            </docking:TabbedMdiHost>
                        </docking:Workspace>
                    </docking:SplitContainer>
                </docking:SplitContainer>
            </docking:DockSite.Content>
        </docking:DockSite>
    </Grid>
</Window>

 Thanks,

-Craig

Comments (1)

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

Hi Craig,

Yes that is the AutoHideHost.Padding you are seeing.  It prevents the normal docked tabs and containers from running up against their host and matches the VS style.

You can remove it on your inner DockSite if you do this:

<docking:DockSite>
	<docking:DockSite.Resources>
		<Style TargetType="dockingPrimitives:AutoHideHost">
			<Setter Property="Padding" Value="0" />
		</Style>
	</docking:DockSite.Resources>
...


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.