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

How to: Enable Automatic Height Adjustment

  • 2 minutes to read

Automatic Node Height Adjustment

The Tree list node height is set to match content height.

TreeList_AutoHeight

Disable Automatic Adjustment

To disable automatic height adjustment, set the TreeList.OptionsBehavior.AutoNodeHeight (see TreeListOptionsBehavior.AutoNodeHeight) property to False.

TreeList_AutoNodeHeight_PropertyWindow

In this mode, node height corresponds to the height of a single text line. Images are scaled to fit automatically calculated height.

TreeList_StandardHeight

Specify Custom Node Height

To specify custom node height, disable automatic height adjustment, and specify the height using the TreeList.RowHeight property.

TreeList_AutoHeight_CustomHeight_PropertyWindow

Once the custom node height has been set, text fields are properly centered, and images are scaled.

TreeList_AutoHeight_CustomHeight

To customize node height, you can also handle the TreeList.CalcNodeHeight event, and specify the CalcNodeHeightEventArgs.NodeHeight event argument.

Automatic Node Height and Image Data

When automatic height adjustment is turned on, images are displayed using their original dimensions as specified in the database. If you delete an image, node height will be automatically adjusted.

TreeList_DifferentHeight

Automatic Node Height and Text Data

To enable automatic height adjustment for cells with text data, select the column and use the TreeListColumn.ColumnEdit property to assign a new MemoEdit editor.

TreeList_MemoEdit_PropertyWindow

Ensure that the RepositoryItemMemoEdit.WordWrap property is set to true and then run the application. The Tree List adjusts the node height, so that the text is completely visible. If you add or remove the text, the height will be updated.

TreeList_DiffHeightText

Specify Custom Image Height

To specify custom height for images, assign a PictureEdit to the column. Use the editor’s RepositoryItemPictureEdit.CustomHeight property to specify the required value.

TreeList_AutoHeight_CustomImageHeight_PropertyWindow

If you run the application, you will see that images are now truncated. The editor allows you to see the entire image by dragging it.

TreeList_AutoHeight_CustomImageHeight

To shrink the images so that they fit the specified cell height, set RepositoryItemPictureEdit.SizeMode to PictureSizeMode.Zoom. Note that in this mode, the node keeps its height if you remove the image.

TreeList_AutoHeight_CustomImageHeight_NoImage

See Also