BaseListBoxControl.ItemAutoHeight Property

Gets or sets whether item height is automatically calculated to fit item contents. In auto-height mode, different items may have different heights.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v21.2.dll


public bool ItemAutoHeight { get; set; }

Property Value

Type Default Description


true if item height is automatically calculated; otherwise, false.


All items initially have the same height, determined by the control’s font. To specify a custom item height, use the ItemHeight property or MeasureItem event.

The ListBoxControl can calculate item height based on content. The options that enable this behavior depend on whether you use item templates.

Regular items

Do the following to enable automatic height calculation:

You can increase the automatically calculated height with the ItemHeight property.

Template-based items

Follow the steps below to enable automatic height calculation:

  • Enable the BaseListBoxControl.ItemAutoHeight property.
  • Enable the TableRowDefinition.AutoHeight setting for required rows in the ListBoxControl’s item template.

ListBox Template Row Auto-Height


The following example enables automatic item height calculation for a sample template-based ListBoxControl. The example allows the row that contains a Notes element to automatically adjust its height. In addition, the code sets the MaxLineCount property to limit the maximum height of the Notes element.

Templated ListBoxControl - Enable Item Auto Height - Example

listBoxControl1.ItemAutoHeight = true;
listBoxControl1.Templates[0].Rows[2].AutoHeight = true;
TemplatedItemElement noteElement = listBoxControl1.Templates[0].Elements["Notes"];
noteElement.MaxLineCount = 9;
See Also