Back to Devexpress

BaseView.ParentView Property

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

latest5.4 KB
Original Source

BaseView.ParentView Property

Gets or sets a master View for the current View.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
[Browsable(false)]
public BaseView ParentView { get; set; }
vb
<Browsable(False)>
Public Property ParentView As BaseView

Property Value

TypeDescription
BaseView

A BaseView descendant representing a parent View.

|

Remarks

Use the ParentView property to obtain a master View for the current View. For GridControl.MainView and pattern Views, the property returns null ( Nothing in Visual Basic). For a detail opened at runtime, the property returns the View whose master row was expanded to open the detail. For instance, for detail clones displayed at the second level, the ParentView property returns the GridControl.MainView object. For detail clones at the third level, the property returns the clone at the second level whose master row was expanded to make this detail visible.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ParentView 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#L30

csharp
if (gridControl1.FocusedView == gridView1) nwindDataSet.Categories.AcceptChanges();
    else if (gridControl1.FocusedView.ParentView == gridView1) nwindDataSet.Products.AcceptChanges();
}

winforms-grid-vertically-align-detail-views/CS/DetailsUnderEachOther/Form1.cs#L81

csharp
GridView realMasterView = (GridView)fakeMasterView.ParentView;
int realMasterRow = fakeMasterView.SourceRowHandle;

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

csharp
object key = GetRowKey((ColumnView)view.ParentView, view.SourceRowHandle);
DataView dv = cache[key] as DataView;

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

vb
nwindDataSet.Categories.AcceptChanges()
ElseIf gridControl1.FocusedView.ParentView Is gridView1 Then
    nwindDataSet.Products.AcceptChanges()

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

vb
Dim fakeMasterView As GridView = CType(sender, GridView)
Dim realMasterView As GridView = CType(fakeMasterView.ParentView, GridView)
Dim realMasterRow As Integer = fakeMasterView.SourceRowHandle

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

vb
If Not view.IsDetailView Then Return
Dim key As Object = GetRowKey(CType(view.ParentView, ColumnView), view.SourceRowHandle)
Dim dv As DataView = TryCast(cache(key), DataView)

See Also

LevelName

DetailLevel

SourceRow

SourceRowHandle

BaseView Class

BaseView Members

DevExpress.XtraGrid.Views.Base Namespace