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.v25.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

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

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetParentByType<T>() method.

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.

See Also