Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

FloatGroup.SizeToContent Attached Property

Gets or sets whether a panel will automatically size itself to fit the size of its content. This is an attached property.

Namespace: DevExpress.Xpf.Docking

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

NuGet Package: DevExpress.Wpf.Docking

#Declaration

#Returns

Type Description
SizeToContent

A SizeToContent enumeration value that specifies whether a panel will automatically size itself to fit the size of its content.

#Remarks

The SizeToContent property specifies whether a panel’s height, width, or both are set to fit the panel content when the panel is floating.

If SizeToContent is Manual, the panel height and width are specified with the BaseLayoutItem.ItemHeight and BaseLayoutItem.ItemWidth properties.

Note

If the panel automatically sizes itself to fit its content, the panel’s BaseLayoutItem.ItemHeight and BaseLayoutItem.ItemWidth properties have no effect.

The following code sample specifies the LayoutPanel‘s SizeToContent property:

<Window  ...
  xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking">
  <dxdo:DockLayoutManager>
    <dxdo:DockLayoutManager.FloatGroups>
      <dxdo:FloatGroup>
        <dxdo:LayoutPanel Caption="Panel1" dxdo:FloatGroup.SizeToContent="WidthAndHeight">
          <!-- LayoutPanel's Content -->
        </dxdo:LayoutPanel>
      </dxdo:FloatGroup>
    </dxdo:DockLayoutManager.FloatGroups>
  </dxdo:DockLayoutManager>
<Window>
See Also