windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-masterrowgetrelationcounteventargs.md
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
public int RelationCount { get; set; }
Public Property RelationCount As Integer
| Type | Description |
|---|---|
| Int32 |
An integer value specifying the number of relations for the master row.
|
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
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
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
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
private void gridView1_MasterRowGetRelationCount(object sender, MasterRowGetRelationCountEventArgs e) {
e.RelationCount = 1;
}
winforms-grid-vertically-align-detail-views/VB/DetailsUnderEachOther/Form1.vb#L47
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
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
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
Private Sub gridView1_MasterRowGetRelationCount(ByVal sender As Object, ByVal e As MasterRowGetRelationCountEventArgs) Handles gridView1.MasterRowGetRelationCount
e.RelationCount = 1
End Sub
See Also
MasterRowGetRelationCountEventArgs Class