Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

WPF Docking Library

, 17 Jul 2007 CPOL
A WPF library to easily integrate Windows docking features in applications like VS
source.zip
DockingLibrary
DockingLibrary
bin
Debug
Release
ClassDiagram1.cd
icons
DockBottom.PNG
DockLeft.PNG
DockPane.PNG
DockRight.PNG
DockTop.PNG
Ritaglio.shs
Thumbs.db
images
DockBottom.PNG
DockLeft.PNG
DockPane.PNG
DockRight.PNG
DockTop.PNG
obj
Debug
Refactor
TempPE
themes
Release
Refactor
TempPE
themes
Properties
Settings.settings
themes
DockingLibraryDemo
bin
Debug
Release
Icons
props.ico
view_remove.ico
view_tree.ico
obj
Debug
TempPE
Release
TempPE
Properties
Settings.settings
<custom:Pane x:Class="DockingLibrary.DocumentsPane"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:custom="clr-namespace:DockingLibrary"  >
	<custom:Pane.Resources>
	<Style x:Key="DocTabItemStyle" TargetType="{x:Type TabItem}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate>
						<Border VerticalAlignment="Bottom" Height="18" BorderThickness="1,1,1,0" CornerRadius="4,4,0,0" x:Name="border" PreviewMouseDown="OnTabItemMouseDown" MouseUp="OnTabItemMouseUp" MouseMove="OnTabItemMouseMove">
							<Border.Background>
								<LinearGradientBrush EndPoint="0.5,0.0" StartPoint="0.5,1">
									<GradientStop Color="{DynamicResource {x:Static SystemColors.ActiveBorderColorKey}}" Offset="0"/>
									<GradientStop Color="#FFFFFFFF" Offset="1"/>
								</LinearGradientBrush>
							</Border.Background>
							<Border.BorderBrush>
								<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.AppWorkspaceColorKey}}"/>
							</Border.BorderBrush>
							<ContentPresenter Content="{TemplateBinding HeaderedContentControl.Header}" Margin="2,0,0,0" x:Name="header"/>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="Selector.IsSelected" Value="True">
								<Setter Property="Background" TargetName="border">
									<Setter.Value>
										<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}"/>
									</Setter.Value>
								</Setter>
								<Setter Property="TextBlock.FontWeight" Value="Bold" TargetName="header"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
   
		<Style x:Key="DocumentsTabSwitchMenuButtonStyle" TargetType="{x:Type Button}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate>
						<Border Height="18">
							<Path Stretch="Fill" Stroke="#FF000000" StrokeEndLineCap="Square" StrokeLineJoin="Round" StrokeThickness="0" Height="Auto" Data="M3,3 L13,3 L8,15" Margin="3,6,3,3">
								<Path.Fill>
									<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlTextColorKey}}"/>
								</Path.Fill>
							</Path>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="DocumentsTabCloseButtonStyle" TargetType="{x:Type Button}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate>
						<Border Height="18" Padding="0,1,0,1">
							<Grid>
								<Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF000000" Margin="3,3,3,3" Data="M0,0L1,1"/>
								<Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF000000" Margin="3,3,3,3" Data="M1,0L0,1"/>
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<ControlTemplate x:Key="DocumentsTabControlTemplate" TargetType="{x:Type TabControl}">
			<Grid x:Name="Grid" KeyboardNavigation.TabNavigation="Local">
				<Grid.ColumnDefinitions>
					<ColumnDefinition x:Name="ColumnDefinition0"/>
					<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
					<RowDefinition x:Name="RowDefinition1" Height="*"/>
				</Grid.RowDefinitions>
				<Border Grid.Row="1" Grid.Column="0" x:Name="ContentPanel" BorderBrush="#FFD0CEBF" BorderThickness="0,0,1,1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.DirectionalNavigation="Contained">
					<Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
						<Border Background="{TemplateBinding Background}" x:Name="Border1">
							<ContentPresenter DataContext="{x:Null}" Margin="{TemplateBinding Padding}" x:Name="PART_SelectedContentHost" Content="{TemplateBinding SelectedContent}" ContentTemplate="{TemplateBinding SelectedContentTemplate}" ContentTemplateSelector="{TemplateBinding SelectedContentTemplateSelector}" ContentSource="SelectedContent"/>
						</Border>
					</Border>
				</Border>
				<ScrollViewer x:Name="HeaderPanel" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
					<ScrollViewer.Style>
						<Style TargetType="{x:Type ScrollViewer}">
							<Setter Property="Template">
								<Setter.Value>
									<ControlTemplate>
										<Grid Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" x:Name="HeaderPanel">
											<Grid.ColumnDefinitions>
												<ColumnDefinition Width="*"/>
												<ColumnDefinition Width="16"/>
												<ColumnDefinition Width="16"/>
											</Grid.ColumnDefinitions>
											<Grid.RowDefinitions>
												<RowDefinition Height="Auto"/>
											</Grid.RowDefinitions>
											<ScrollContentPresenter Grid.Column="0" Content="{TemplateBinding ScrollViewer.Content}" />
											<Button Grid.Column="1" Style="{StaticResource DocumentsTabSwitchMenuButtonStyle}" PreviewMouseDown="OnBtnDocumentsMenu">
											</Button>
											<Button Grid.Column="2" Style="{StaticResource DocumentsTabCloseButtonStyle}" PreviewMouseDown="OnBtnDocumentClose"/>
										</Grid>
 									</ControlTemplate>
 								</Setter.Value>
 							</Setter>
 						</Style>
 					</ScrollViewer.Style>
 				
					<StackPanel IsItemsHost="True" Orientation="Horizontal" Background="{x:Null}" KeyboardNavigation.TabIndex="1" />
				</ScrollViewer>

    </Grid>
	</ControlTemplate>
	
	</custom:Pane.Resources>
	<Grid>
		<TabControl Name="tbcDocuments" IsSynchronizedWithCurrentItem="True"   Template="{DynamicResource DocumentsTabControlTemplate}" Visibility="Collapsed">
		</TabControl>
	</Grid>
</custom:Pane>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

adospace.NET
Systems Engineer
Italy Italy
I bought my first computer in Nov 1991, 21th and I started programming with QBasic under MSDOS.
Today my main interest is developping application with .NET 3.5.
Visit YouDev.net for tutorials on AvalonDock, download WPF controls, samples and code.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411022.1 | Last Updated 17 Jul 2007
Article Copyright 2007 by adospace.NET
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid