Back to Devexpress

MasterRowGetRelationCountEventArgs.RelationCount Property

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

latest6.1 KB
Original Source

MasterRowGetRelationCountEventArgs.RelationCount Property

Gets or sets the number of relations for the master row.

Namespace : DevExpress.XtraGrid.Views.Grid

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
public int RelationCount { get; set; }
vb
Public Property RelationCount As Integer

Property Value

TypeDescription
Int32

An integer value specifying the number of relations for the master row.

|

Remarks

Initially, the RelationCount property contains the default number of relations specified by the grid control’s data source. You can change this value to specify your own number of relations. For instance, you can provide detail data manually by handling the GridView.MasterRowGetChildList event while the data source actually has no detail data. To do so, set the RelationCount to a positive value specifying the number of details for the current row. In this case, the GridView.MasterRowEmpty and GridView.MasterRowGetRelationName events will also be raised for each row the number of times specified by the relation number.

The following code snippets (auto-collected from DevExpress Examples) contain references to the RelationCount 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-vertically-align-detail-views/CS/DetailsUnderEachOther/Form1.cs#L45

csharp
private void gvMaster_MasterRowGetRelationCount(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetRelationCountEventArgs e) {
    e.RelationCount = 1;
}

winforms-grid-master-detail-entity-framework/CS/Entities/Form1.cs#L23

csharp
private void OnMasterRowGetRelationCount(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetRelationCountEventArgs e) {
    e.RelationCount = 1;
}

winforms-grid-load-refresh-detail-data-from-database/CS/WindowsApplication297/Form1.cs#L81

csharp
private void gridView1_MasterRowGetRelationCount(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetRelationCountEventArgs e) {
    e.RelationCount = 1;
}

winforms-grid-master-detail-async-load-detail-data/CS/WindowsFormsSample/Form1.cs#L33

csharp
private void gridView1_MasterRowGetRelationCount(object sender, MasterRowGetRelationCountEventArgs e) {
    e.RelationCount = 1;
}

winforms-grid-vertically-align-detail-views/VB/DetailsUnderEachOther/Form1.vb#L47

vb
Private Sub gvMaster_MasterRowGetRelationCount(ByVal sender As Object, ByVal e As MasterRowGetRelationCountEventArgs)
    e.RelationCount = 1
End Sub

winforms-grid-master-detail-entity-framework/VB/Entities/Form1.vb#L25

vb
Private Sub OnMasterRowGetRelationCount(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.MasterRowGetRelationCountEventArgs) Handles gridView1.MasterRowGetRelationCount
    e.RelationCount = 1
End Sub

winforms-grid-load-refresh-detail-data-from-database/VB/WindowsApplication297/Form1.vb#L81

vb
Private Sub gridView1_MasterRowGetRelationCount(ByVal sender As Object, ByVal e As MasterRowGetRelationCountEventArgs)
    e.RelationCount = 1
End Sub

winforms-grid-master-detail-async-load-detail-data/VB/WindowsFormsSample/Form1.vb#L35

vb
Private Sub gridView1_MasterRowGetRelationCount(ByVal sender As Object, ByVal e As MasterRowGetRelationCountEventArgs) Handles gridView1.MasterRowGetRelationCount
    e.RelationCount = 1
End Sub

See Also

MasterRowGetRelationCountEventArgs Class

MasterRowGetRelationCountEventArgs Members

DevExpress.XtraGrid.Views.Grid Namespace