Skip to main content

ScrollBox Class

Represents a container that supports absolute positioning of child controls and enables scrolling.

Namespace: DevExpress.Xpf.LayoutControl

Assembly: DevExpress.Xpf.LayoutControl.v24.2.dll

NuGet Package: DevExpress.Wpf.LayoutControl

Declaration

public class ScrollBox :
    LayoutControlBase

Remarks

Controls can be freely positioned within the ScrollBox. You can specify a child control’s position via the ScrollBox.Top and ScrollBox.Left attached properties.

The ScrollBox container takes into account the size and position of its child controls when calculating its client size. So, if the container’s size is not explicitly limited (for instance, via its Width and Height properties), its size will be calculated to fit all its children.

If the container’s size is limited and a child control or part of the control is positioned outside the visual bounds of the ScrollBox, scroll bars appear, enabling scrolling.

The ScrollBox’s LayoutControlBase.Padding inherited property affects the offset of the client area where child controls reside. Therefore, this property affects the offsets of the child controls from the ScrollBox’s left and top edges.

<lc:ScrollBox x:Name="myScrollBox"  Background="#FF91B6B9" >
        <Button Content="Button 1" Height="50" Width="100" Margin="10,0,0,0"/>
        <Button Content="Button 2" Height="50" Width="100" lc:ScrollBox.Left="120"/>
    </lc:ScrollBox>
See Also