Skip to main content
Box

LayoutElement.GetParentByType<T>() Method

Returns the parent layout element of the type designated by the specified generic type parameter.

Namespace: DevExpress.XtraRichEdit.API.Layout

Assembly: DevExpress.RichEdit.v24.1.Core.dll

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

T GetParentByType<T>()
    where T : class

Type Parameters

Name Description
T

The element type.

Returns

Type Description
T

The layout element of the type designated by the specified generic type parameter.

Remarks

Gets the element of the specified type which is higher in the layout hierarchy.

Example

View Example

Friend Class MyDocumentLayoutVisitor
    Inherits DevExpress.XtraRichEdit.API.Layout.LayoutVisitor

    Protected Overrides Sub VisitRow(ByVal row As DevExpress.XtraRichEdit.API.Layout.LayoutRow)
        If row.GetParentByType(Of DevExpress.XtraRichEdit.API.Layout.LayoutPageArea)() IsNot Nothing Then
            System.Diagnostics.Debug.WriteLine("This row is located at X: {0}, Y: {1}, related range starts at {2}", row.Bounds.X, row.Bounds.Y, row.Range.Start)
        End If
        ' Call the base VisitRow method to walk down the tree to the child elements of the Row.
        ' If you don't need them, comment out the next line. 
        MyBase.VisitRow(row)
    End Sub

    Protected Overrides Sub VisitPage(ByVal page As DevExpress.XtraRichEdit.API.Layout.LayoutPage)
        System.Diagnostics.Debug.WriteLine("Visiting page {0}", page.Index +1)
        MyBase.VisitPage(page)
    End Sub


End Class
See Also