Back to Devexpress

RepositoryItemComboBox.ItemAutoHeight Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemcombobox-bfb37258.md

latest2.6 KB
Original Source

RepositoryItemComboBox.ItemAutoHeight Property

Gets or sets whether the height of items is automatically calculated to fit their entire content.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(false)]
[DXCategory("Behavior")]
public virtual bool ItemAutoHeight { get; set; }
vb
<DXCategory("Behavior")>
<DefaultValue(False)>
Public Overridable Property ItemAutoHeight As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

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

|

Remarks

By default, all items have the same height, sufficient to display a single line of text using the current font settings. By enabling the ItemAutoHeight property, you allow items to have different heights, each of which corresponds to the particular item content. For instance, this property may be useful if items have different a number of text lines.

csharp
comboBoxEdit1.Properties.ItemAutoHeight = true;
comboBoxEdit1.Properties.Items.Add("1st item");
comboBoxEdit1.Properties.Items.Add("2nd item\r\n2nd item");
vb
comboBoxEdit1.Properties.ItemAutoHeight = True
comboBoxEdit1.Properties.Items.Add("1st item")
comboBoxEdit1.Properties.Items.Add("2nd item\r\n2nd item")

If the automatic height calculation does not feet your needs, you can also set custom heights to particular items by handling the RepositoryItemComboBox.MeasureItem event.

See Also

MeasureItem

RepositoryItemComboBox Class

RepositoryItemComboBox Members

DevExpress.XtraEditors.Repository Namespace