Skip to main content
A newer version of this page is available. .

SimpleButton.AutoWidthInLayoutControl Property

Gets or sets whether the control’s width is changed to display the control’s content in its entirety. This property is in effect when the control resides within a LayoutControl.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v19.1.dll

Declaration

[DXCategory("Properties")]
[DefaultValue(false)]
public bool AutoWidthInLayoutControl { get; set; }

Property Value

Type Default Description
Boolean **false**

true if auto-size mode is enabled; otherwise, false.

Remarks

When a control is displayed within a LayoutControl, you can use the AutoWidthInLayoutControl property to enable the auto-width feature. In this instance, the control’s width is changed to display the control’s text in its entirety.

The layout control allows you to set size constraints for controls, specifying the range in which the control’s size can vary. See the Size Constraints topic, for more information.

Example

The following code shows how to enable the auto-width feature for a SimpleButton within a LayoutControl and center this button within the corresponding layout item:

SimpleButton_AlignHorizontally

For more information on control alignment, see Aligning Controls Within Layout Items.

using DevExpress.XtraLayout;

simpleButton1.AutoWidthInLayoutControl = true;
layoutControlItem1.SizeConstraintsType = SizeConstraintsType.SupportHorzAlignment;
layoutControlItem1.ControlAlignment = ContentAlignment.TopCenter;
See Also