Back to Devexpress

ImageProperties.VerticalAlignment Property

blazor-devexpress-dot-blazor-dot-richedit-dot-imageproperties-b15b015e.md

latest4.2 KB
Original Source

ImageProperties.VerticalAlignment Property

Specifies an image’s vertical alignment relative to a vertical anchor element.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

csharp
public FloatingObjectVerticalAlignment VerticalAlignment { get; set; }

Property Value

TypeDescription
FloatingObjectVerticalAlignment

The vertical alignment.

|

Available values:

NameDescription
None

A floating object is not aligned.

| | Top |

A floating object is aligned to the top of a vertical anchor element.

| | Center |

A floating object is aligned to the center of a vertical anchor element.

| | Bottom |

A floating object is aligned to the bottom of a vertical anchor element.

| | Inside |

Currently not supported and is displayed as the Top alignment type. Floating objects are aligned to the top of a vertical anchor element for odd pages, and the bottom of a vertical anchor element for even pages.

| | Outside |

Currently not supported and is displayed as the Bottom alignment type. Floating objects are aligned to the bottom of a vertical anchor element for odd pages, and the top of a vertical anchor element 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.VerticalAlignment != FloatingObjectVerticalAlignment.Center)
                    properties.VerticalAlignment = FloatingObjectVerticalAlignment.Center;
            });
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Use the VerticalAlignment property to get the vertical alignment of the image.

See Also

ImageProperties Class

ImageProperties Members

DevExpress.Blazor.RichEdit Namespace