Click here to Skip to main content
Click here to Skip to main content

Tagged as

DockPanel Splitter Control for WPF

, 10 Aug 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
A splitter control for the WPF DockPanel
Sample Image


This control adds size adjustment functionality to elements of a DockPanel in the same way a GridSplitter can adjust the size of columns and rows in a Grid. When resizing the parent container, the elements will be resized proportionally unless the ProportionalResize property is set to False.

Using the Code

Add the OpenSourceControls namespace and add a DockPanelSplitter control after each panel you want to adjust. The DockPanel.Dock attribute controls which edge of the panel the splitter works on.

<Window x:Class="DockPanelSplitterDemo.Window1"
    Title="DockPanelSplitter demo" Height="400" Width="600">
        <Grid Name="LeftPane" DockPanel.Dock="Left" 
                      Width="200" MinWidth="40">
            <Rectangle Fill="LightBlue"/>
        <osc:DockPanelSplitter DockPanel.Dock="Left" Width="4"/>
        <Grid Name="RightPane" DockPanel.Dock="Right" Width="80">
            <Rectangle Fill="Yellow"/>
        <osc:DockPanelSplitter DockPanel.Dock="Right" Width="4"/>
        <Grid Name="TopPane" DockPanel.Dock="Top" 
                     Height="80" MinHeight="20">
            <Rectangle Fill="LightGreen"/>
        <osc:DockPanelSplitter DockPanel.Dock="Top" Height="4"/>
        <Grid Name="BottomPane" DockPanel.Dock="Bottom" Height="70">
            <Rectangle Fill="LightPink"/>
        <osc:DockPanelSplitter DockPanel.Dock="Bottom" Height="4"/>
        <Grid Name="MainPane" Background="Coral" >
            <Rectangle Fill="Coral"/>

The proportional sizing mode can be turned off by setting the ProprtionalResize dependency property to False.

<osc:DockPanelSplitter DockPanel.Dock="Right" Width="4" ProportionalResize="False"/>

Links to Related Projects

  • WpfContrib DockSplitter (cannot find the control in ProportionalResize dependency property to False. Creating resizable panels with splitter bars (links don't work??)
  • Thumb example

Future Enhancements

  • Use the Thumb control instead of capturing mouse events


  • March 21, 2009 - First post
  • May 25, 2009 - Added proportional resizing
  • August 09, 2009 - Changed to custom control, added template demo, constrained size on client area


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


About the Author


Norway Norway
No Biography provided

Comments and Discussions

GeneralVery helpfull control - thank you! PinmemberMember 99136139-May-14 9:42 
QuestionNameSpace Error PinmemberSurjeet Karmakar6-Nov-13 20:24 
SuggestionSuggestion For Expanders Pinmemberc_manboy6-Oct-13 14:53 
QuestionExcellent control Pinmemberrquintalr27-May-13 4:15 
GeneralMy vote of 5 PinmemberPreev21-Mar-12 14:17 
GeneralMy vote of 5 Pinmembernapnit10-Nov-11 2:11 
QuestionHow to collapse one side, the other side, or both sides of the DockPanelSplitter control? PinmemberCDCii27-Sep-11 9:55 
AnswerRe: How to collapse one side, the other side, or both sides of the DockPanelSplitter control? Pinmemberobjo29-Sep-11 21:32 
GeneralMy vote of 5 Pinmemberferahl28-Apr-11 7:45 
Generalsilverlight Pinmemberfel0nious1-Nov-10 11:50 
GeneralRe: silverlight Pinmemberdaniel Moody17-Jul-12 10:58 
GeneralSplitter movement restriction PinmemberPrasoon Chaudhary29-Apr-10 10:06 
GeneralSystem.ArgumentException was unhandled Pinmemberkiol28-Jan-10 23:40 
GeneralRe: System.ArgumentException was unhandled Pinmemberobjo2-Feb-10 5:29 
GeneralRe: System.ArgumentException was unhandled PinmemberHHick1234512-May-10 2:42 
GeneralCode Behind PinmemberJason McPeak15-Dec-09 4:41 
GeneralRe: Code Behind PinmemberJason McPeak15-Dec-09 5:39 
AnswerRe: Code Behind Pinmemberobjo15-Dec-09 5:53 
NewsRe: Code Behind PinmemberJason McPeak15-Dec-09 6:05 
GeneralRe: Code Behind PinmemberJason McPeak15-Dec-09 6:44 
GeneralRe: Code Behind PinmemberJason McPeak15-Dec-09 6:58 
GeneralWell done! Pinmemberbrents11-Dec-09 15:25 
GeneralTo add this code to your own assembly... PinmemberSerialHobbyist17-Aug-09 4:02 
AnswerRe: To add this code to your own assembly... Pinmemberobjo17-Aug-09 7:33 
GeneralRe: To add this code to your own assembly... PinmemberJason McPeak15-Dec-09 5:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141220.1 | Last Updated 10 Aug 2009
Article Copyright 2009 by objo
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid