Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SectionProperties.Landscape Property

Specifies the orientation of the section’s pages.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

#Declaration

C#
public bool Landscape { get; set; }

#Property Value

Type Description
Boolean

true to set the landscape orientation; false to set the portrait orientation.

#Remarks

You can set a section’s page orientation in the following ways:

  • Select the Page LayoutOrientationPortrait ribbon command to set page orientation of the selected section to portrait.

  • Select the Page LayoutOrientationLandscape ribbon command to set page orientation of the selected section to landscape.

  • Call the section’s ChangePropertiesAsync method.

The following code snippet sets the orientation of every page in the open document to portrait.

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;
            var sections = await documentAPI.Sections.GetAllAsync();
            foreach (Section s in sections)
                await s.ChangePropertiesAsync(properties => {
                    if (s.Landscape == true)
                        properties.Landscape = false;
                });
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

If a user changes a page orientation, the PageSize.Width property value becomes the PageSize.Height property value and vice versa. If you change the section’s PageSize.Height and/or PageSize.Width property value, the Rich Text Editor updates the Landscape property with the matching value.

See Also