Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
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.v19.1.Core.dll

Declaration

T GetParentByType<T>()
    where T : class

Type Parameters

Name
T

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

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