Back to Devexpress

CustomMasterRowEventArgs.RelationIndex Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-custommasterroweventargs.md

latest3.5 KB
Original Source

CustomMasterRowEventArgs.RelationIndex Property

Gets the relation index that identifies the affected detail.

Namespace : DevExpress.XtraGrid.Views.Grid

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
public int RelationIndex { get; }
vb
Public ReadOnly Property RelationIndex As Integer

Property Value

TypeDescription
Int32

An integer value specifying the relation index.

|

Remarks

Master rows can have several detail Views. In such cases, you will need to determine the detail clone affected when handling operations on master rows. Use the RelationIndex property for this purpose. The number of details for a specific row is determined by the GridView.GetRelationCount method.

You can determine the relation name by the relation index using the View’s GridView.GetRelationName method. The corresponding detail View clone can be obtained using the GridView.GetDetailView method.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RelationIndex 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-auto-expand-new-master-row/CS/Q205071/Form1.cs#L55

csharp
view.MasterRowExpanded -= OnGridViewMasterRowExpanded;
GridView childView = (GridView)view.GetDetailView(e.RowHandle, e.RelationIndex);
childView.AddNewRow();

winforms-grid-auto-expand-new-master-row/VB/Q205071/Form1.vb#L57

vb
RemoveHandler view.MasterRowExpanded, AddressOf OnGridViewMasterRowExpanded
Dim childView As GridView = CType(view.GetDetailView(e.RowHandle, e.RelationIndex), GridView)
childView.AddNewRow()

See Also

GetRelationCount(Int32)

CustomMasterRowEventArgs Class

CustomMasterRowEventArgs Members

DevExpress.XtraGrid.Views.Grid Namespace