Back to Devexpress

BaseView.DetailHeight Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-baseview-aa9103aa.md

latest4.9 KB
Original Source

BaseView.DetailHeight Property

Gets or sets the maximum height of a View when it serves as a detail View.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(350)]
[DXCategory("Appearance")]
[XtraSerializableProperty]
public virtual int DetailHeight { get; set; }
vb
<DefaultValue(350)>
<XtraSerializableProperty>
<DXCategory("Appearance")>
Public Overridable Property DetailHeight As Integer

Property Value

TypeDefaultDescription
Int32350

An integer value specifying the View height in pixels.

|

Remarks

The DetailHeight property of pattern Views specifies the maximum height its clones have when an end-user expands master rows. When you change the DetailHeight property of an expanded clone view, this clone’s height is changed. A detail does not display empty space below its rows. So, the detail height cannot be greater than the height required to display all detail rows.

The following applies to Layout Views (LayoutView objects), when they are displayed as details.

Auto-height mode is enabled for detail Layout Views by default. The DetailHeight property specifies the detail’s maximum height. The detail shrinks its height to vertically fit displayed cards (see LayoutViewOptionsView.ViewMode and LayoutViewOptionsMultiRecordMode.MaxCardRows).

If you need a detail height to be fixed and equal to a specific value, disable the auto-height feature with the LayoutView.DetailAutoHeight property and specify the required height via the DetailHeight setting.

The detail auto-height feature is not in effect if card stretching is enabled via the StretchCardToViewHeight property (see LayoutViewOptionsSingleRecordMode.StretchCardToViewHeight and LayoutViewOptionsMultiRecordMode.StretchCardToViewHeight).

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DetailHeight property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-grid-use-layoutview-as-master-view/CS/WindowsApplication3/MasterDetailHelper.cs#L136

csharp
ColumnViewInfo viewInfo = DetailView.GetViewInfo() as ColumnViewInfo;
Rectangle rect = new Rectangle(0, 0, view.GridControl.ClientSize.Width, DetailView.DetailHeight);
rect.Height = viewInfo.CalcRealViewHeight(rect, true) + 5;

winforms-grid-use-layoutview-as-master-view/VB/WindowsApplication3/MasterDetailHelper.vb#L147

vb
Dim viewInfo As ColumnViewInfo = TryCast(DetailView.GetViewInfo(), ColumnViewInfo)
Dim rect As New Rectangle(0, 0, view.GridControl.ClientSize.Width, DetailView.DetailHeight)
rect.Height = viewInfo.CalcRealViewHeight(rect, True) + 5

See Also

DetailAutoHeight

Master-Detail Relationships

BaseView Class

BaseView Members

DevExpress.XtraGrid.Views.Base Namespace