alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download

    Show / Hide Table of Contents

    Class DialogPositionData

    A class used in the SfDialog to configure the custom position within the document or target.

    Inheritance
    System.Object
    DialogPositionData
    Namespace: Syncfusion.Blazor.Popups
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DialogPositionData : OwningComponentBase
    Remarks

    The DialogPositionData class allows you to specify custom positioning for the SfDialog component. You can set both X and Y coordinates to position the dialog at a specific location within the viewport or relative to a target element. The position values can be specified as pixels, percentages, or predefined keywords like "center", "top", "bottom", "left", and "right".

    Examples

    In the following example, position the dialog at the center horizontally and top vertically.

    @using Syncfusion.Blazor.Popups
    <SfDialog Width="500px" @bind-Visible="Visibility">
      <DialogTemplates>
        <Content>
            <p>
               Dialog content
              </p>
          </Content>
      </DialogTemplates>
      <DialogPositionData X="center" Y="top">
      </DialogPositionData>
      </SfDialog>
     @code {
      private bool Visibility { get; set; } = true;
     }

    Constructors

    DialogPositionData()

    Declaration
    public DialogPositionData()

    Properties

    X

    Gets or sets the horizontal position (X-coordinate) for positioning the SfDialog.

    Declaration
    public string X { get; set; }
    Property Value
    Type Description
    System.String

    A string that specifies the horizontal position of the dialog. This can be:

    • A numeric value in pixels (e.g., "100", "200px")
    • A percentage value (e.g., "50%")
    • Predefined keywords: "left", "center", "right"
    The default value is null.
    Remarks

    The X property controls the horizontal positioning of the dialog within its container or viewport. When using keywords, "left" positions the dialog at the left edge, "center" centers it horizontally, and "right" positions it at the right edge. Numeric values position the dialog at the specified distance from the left edge of the container.

    Y

    Gets or sets the vertical position (Y-coordinate) for positioning the SfDialog.

    Declaration
    public string Y { get; set; }
    Property Value
    Type Description
    System.String

    A string that specifies the vertical position of the dialog. This can be:

    • A numeric value in pixels (e.g., "100", "200px")
    • A percentage value (e.g., "50%")
    • Predefined keywords: "top", "center", "bottom"
    The default value is null.
    Remarks

    The Y property controls the vertical positioning of the dialog within its container or viewport. When using keywords, "top" positions the dialog at the top edge, "center" centers it vertically, and "bottom" positions it at the bottom edge. Numeric values position the dialog at the specified distance from the top edge of the container.

    Methods

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public virtual void Dispose()
    Remarks

    This method releases all resources used by the DialogPositionData component. It is automatically called when the component is no longer needed to ensure proper cleanup.

    Dispose(Boolean)

    Releases the unmanaged resources used by the DialogPositionData and optionally releases the managed resources.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    Remarks

    This method is called by the public Dispose() method and the finalizer. When disposing is true, this method releases all resources held by any managed objects that this component references. The method also clears the reference to the parent dialog to prevent memory leaks.

    OnInitializedAsync()

    Method invoked when the component is ready to start, typically after the component has been rendered to the page.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This method is called once when the component is initialized. It registers the position data with the parent dialog and stores the initial X and Y values for change detection in subsequent parameter updates.

    OnParametersSetAsync()

    Method invoked when the component has received parameters from its parent and any time afterwards when the parent renders.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This method is called whenever the component's parameters are updated. It compares the new X and Y values with the previous ones and triggers a position change in the dialog if any differences are detected. This ensures the dialog's position is updated dynamically when the position parameters change.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved