Skip to main content

WindowDragStartedEventArgs Class

Contains data for the DragStarted event.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public class WindowDragStartedEventArgs :
    EventArgs

Remarks

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

<div class="d-flex justify-content-center p-3" @ref=@popupTarget>
    <DxButton RenderStyle="ButtonRenderStyle.Secondary" Click="@TogglePopupVisibilityAsync">@GetButtonText()</DxButton>
</div>
<DxWindow AllowDrag=true
        @ref=@windowRef
        DragCompleted="OnWindowDragCompleted"
        ShowCloseButton="true"
        HeaderText="Window"
        BodyText="@Constants.Text"
        Width="max(25vw, 250px)"
        SizeMode="Params.SizeMode"
        @bind-Visible="windowVisible">
</DxWindow>
@code {
int? positionX, positionY;
bool windowVisible;
DxWindow windowRef;
ElementReference popupTarget;
async Task OnWindowDragCompleted(WindowDragCompletedEventArgs args) {
    (positionX, positionY) = (args.End.X, args.End.Y);
    await SavePositionToLocalStorageAsync(args.End);
}
string GetButtonText() => !windowVisible ? "SHOW A WINDOW" : "CLOSE A WINDOW";
}

Run Demo: Window - Dragging

Inheritance

Object
EventArgs
WindowDragStartedEventArgs
See Also