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

DxPopup.DragStarted Event

Fires when a user drags the Popup or resizes it by edges.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public EventCallback<PopupDragStartedEventArgs> DragStarted { get; set; }

#Event Data

The DragStarted event's data class is PopupDragStartedEventArgs. The following properties provide information specific to this event:

Property Description
CancellationToken Specifies an object that propagates a cancellation notification.
Position Returns the Popup’s position before a drag-and-drop operation.

#Remarks

When the AllowDrag property is set to true, users can drag the Popup. Handle the DragStarted event to be notified when a user starts to drag the component. The event argument’s Position parameter returns the Popup’s initial position.

The following code snippet saves the Popup’s initial position:

Razor
<div @onclick="@(() => PopupVisible = true)">
    <p>CLICK TO SHOW A POP-UP WINDOW</p>
</div>

<DxPopup @bind-Visible="@PopupVisible"
         HeaderText="Header"
         BodyText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sit amet metus vel
                   nisi blandit tincidunt vel efficitur purus. Nunc nec turpis tempus, accumsan orci auctor,
                   imperdiet mauris. Fusce id purus magna."
         AllowDrag="true"
         DragStarted="BeforeDrag">
</DxPopup>

@code {
    bool PopupVisible { get; set; } = false;
    int positionX = 250, positionY = 250;
    void BeforeDrag(PopupDragStartedEventArgs e) {
        (positionX, positionY) = (e.Position.X, e.Position.Y);
    }
}

Note that the DragStarted event also fires when you resize the component by its edges.

Handle the DragCompleted event to be notified when a user finishes dragging the Popup.

See Also