Back to Devexpress

ImageProperties.VerticalAnchorElement Property

blazor-devexpress-dot-blazor-dot-richedit-dot-imageproperties-421d20d6.md

latest3.7 KB
Original Source

ImageProperties.VerticalAnchorElement Property

Specifies the element to which an image is vertically aligned.

Namespace : DevExpress.Blazor.RichEdit

Assembly : DevExpress.Blazor.RichEdit.v25.2.dll

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

csharp
public FloatingObjectVerticalAnchorElement VerticalAnchorElement { get; set; }

Property Value

TypeDescription
FloatingObjectVerticalAnchorElement

The vertical anchor element.

|

Available values:

NameDescription
Page

A floating object is aligned to a page.

| | Line |

A floating object is aligned to a line.

| | Paragraph |

A floating object is aligned to a paragraph.

| | Margin |

A floating object is aligned to the top or bottom page margin, or centered vertically.

| | TopMargin |

A floating object is aligned to the top margin.

| | BottomMargin |

A floating object is aligned to the bottom margin.

| | InsideMargin |

Currently not supported and is treated as the TopMargin anchor element.
Floating objects are aligned to the top margin for odd pages, and the bottom margin for even pages.

| | OutsideMargin |

Currently not supported and is treated as the BottomMargin anchor element.
Floating objects are aligned to the bottom margin for odd pages, and the top margin for even pages.

|

Remarks

Use any of the following properties to define a vertical position of an image relative to its vertical anchor element:

VerticalAlignmentVertically aligns an image. If you set this property to a value different from None, the Rich Text Editor sets the VerticalOffset and VerticalRelativeOffset properties to 0.VerticalOffsetDefines an image’s vertical offset in twips. If you set this property to a value different from 0, the Rich Text Editor sets the VerticalRelativeOffset property to 0.VerticalRelativeOffsetDefines an image’s vertical offset in percentage.

razor
<DxRichEdit @ref="richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            Image firstImage = await documentAPI.Images.GetAsync(0);
            @* ... *@
            await firstImage.ChangePropertiesAsync(properties => {
                if (firstImage.VerticalAnchorElement != FloatingObjectVerticalAnchorElement.Page)
                    properties.VerticalAnchorElement = FloatingObjectVerticalAnchorElement.Page;
            });
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Use the VerticalAnchorElement property to get the vertical anchor element of the image.

See Also

ImageProperties Class

ImageProperties Members

DevExpress.Blazor.RichEdit Namespace