Click here to Skip to main content
15,881,757 members
Articles / Desktop Programming / WPF

WPF Docking Library

Rate me:
Please Sign up or sign in to vote.
4.78/5 (85 votes)
17 Jul 2007CPOL3 min read 1M   24.4K   317  
A WPF library to easily integrate Windows docking features in applications like VS
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:DockingLibrary"
    >

    <Style TargetType="{x:Type local:DockingButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DockingButton}">
                    <!--<Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                    </Border>-->
					<Border Name="PART_Border" CornerRadius="0,0,4,4" BorderThickness="1" BorderBrush="Gray">
						<Border.Background>
							<SolidColorBrush Color="LightGray"/>
						</Border.Background>
						<StackPanel Orientation="Horizontal">
							<Image Source="{Binding Path=DockableContent.Icon, RelativeSource={RelativeSource TemplatedParent}}" Margin="2,2,2,2"/>
							<Border Width="2" Height="2"/>
							<TextBlock Text="{Binding Path=DockableContent.Title, RelativeSource={RelativeSource TemplatedParent}}"  Foreground="DarkGray" Margin="2,2,2,2"/>
						</StackPanel>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="Dock" Value="Left">
							<Setter TargetName="PART_Border" Property="CornerRadius" Value="4,4,0,0"/>
						</Trigger>
						<Trigger Property="Dock" Value="Bottom">
							<Setter TargetName="PART_Border" Property="CornerRadius" Value="4,4,0,0"/>
						</Trigger>

					</ControlTemplate.Triggers>					
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

	<!--<Style x:Key="DockDownButtonSyle" TargetType="{x:Type Button}">
		<Setter Property="Control.Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Grid>
						<Rectangle Stroke="#FF000000" RadiusX="5" RadiusY="5">
							<Rectangle.Fill>
								<LinearGradientBrush EndPoint="0.961,0.961" StartPoint="-0.197,-0.197">
									<GradientStop Color="#FF000000" Offset="0"/>
									<GradientStop Color="#FFFFFFFF" Offset="1"/>
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Rectangle RadiusX="1" RadiusY="1" Fill="#FFFFFFFF" Stroke="#FF0054E3" Margin="4,4,4,4"/>
						<Rectangle Stroke="#FF000000" StrokeThickness="0" Margin="5,5,5,0" VerticalAlignment="Top" Height="3">
							<Rectangle.Fill>
								<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
									<GradientStop Color="#FF0232F8" Offset="0"/>
									<GradientStop Color="#FFCAD9F8" Offset="1"/>
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Rectangle Fill="#FFF81818" StrokeThickness="0" Width="2" Height="2" HorizontalAlignment="Right" Margin="0,5.5,5.5,0" VerticalAlignment="Top"/>
						<Rectangle RenderTransformOrigin="0.5,0.5" Margin="5,8,5,22">
							<Rectangle.Fill>
								<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
									<GradientStop Color="#FFB4C1F8" Offset="0"/>
									<GradientStop Color="#FFDAE1FE" Offset="1"/>
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>

						<Path Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" Height="Auto" Data="M0,0 L1,-1 L2,0 z"  Margin="18,0,18,12" VerticalAlignment="Bottom"/>

						<Path Stretch="Fill" Margin="5,22,5,22" Data="M0,0L1,0">
							<Path.Stroke>
								<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlDarkColorKey}}"/>
							</Path.Stroke>
						</Path>
					</Grid>													
					
							</ControlTemplate>
				
					 </Setter.Value>	  
			
			  </Setter>   
		
		
	   </Style>-->

</ResourceDictionary>

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)


Written By
Systems Engineer
Italy Italy
I bought my first computer in Nov 1991, 21st and I started programming with QBasic under MSDOS.
Today my main interest is developping applications with .NET and HTML5 stack.

Comments and Discussions