Skip to main content

SplitterControl Class

Allows end users to resize controls that are docked to the splitter’s edges.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.Utils.v23.2.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public class SplitterControl :
    Splitter,
    ISupportLookAndFeel,
    IXtraSerializable,
    IXtraSerializable2,
    ISupportAppearanceObjectPropertiesFilter

Remarks

The Splitter Control gives end users the ability to resize controls that are docked to its edges at runtime. The base functionality is inherited from the Splitter class.

SplitterControl

The Splitter Control supports the look and feel mechanism and appearances, which can be accessed from the SplitterControl.LookAndFeel and SplitterControl.Appearance properties, respectively.

The code sample below illustrates how to create and set up a vertical Splitter Control.

// Control #1: Dock Style is "Left" or "Top"
LabelControl lblLeft = new LabelControl();
lblLeft.Dock = DockStyle.Left;
lblLeft.Text = "Left Pane Control";
SetUpOptionalLabelProperties(lblLeft);

// Control #2: Dock Style is "Left" or "Top"
LabelControl lblRight = new LabelControl();
lblRight.Dock = DockStyle.Fill;
lblRight.Text = "Right Pane Control";
SetUpOptionalLabelProperties(lblRight);

// Splitter: Dock Style is same as for Control #1
SplitterControl splitter = new SplitterControl();
this.Controls.Add(splitter);
splitter.Dock = DockStyle.Left;
splitter.MinExtra = 150; // Right area min size
splitter.MinSize = 200; // Left area min size

lblLeft.Width = 1000; // How to move splitter in code

// Add controls backwards (from right to left, or bottom to top)
this.Controls.AddRange(new Control[] { lblRight, splitter, lblLeft });

void SetUpOptionalLabelProperties(LabelControl target) {
    target.AutoSizeMode = LabelAutoSizeMode.None;
    target.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
    target.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
    target.Appearance.Font = new System.Drawing.Font("Segoe UI Semibold", 26F);
}
See Also