Back to Devexpress

WorkspaceManager.BeforeApplyWorkspace Event

windowsforms-devexpress-dot-utils-dot-workspacemanager-14fac570.md

latest2.6 KB
Original Source

WorkspaceManager.BeforeApplyWorkspace Event

Fires before the Workspace Manager applies a new workspace.

Namespace : DevExpress.Utils

Assembly : DevExpress.Utils.v25.2.dll

NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core

Declaration

csharp
[DXCategory("Behavior")]
public event EventHandler BeforeApplyWorkspace
vb
<DXCategory("Behavior")>
Public Event BeforeApplyWorkspace As EventHandler

Event Data

The BeforeApplyWorkspace event's data class is EventArgs.

Remarks

The Workspace Manager fires the BeforeApplyWorkspace event when a user applies a new workspace or when you call the ApplyWorkspace(String) method. Once the workspace is applied, the Workspace Manager fires the WorkspaceManager.AfterApplyWorkspace event.

Example

The following example demonstrates how to obtain the name of a workspace before it is applied. Typecast the default event args to WorkspaceEventArgs and use the Workspace property to obtain the workspace.

csharp
using DevExpress.Utils;

private void workspaceManager1_BeforeApplyWorkspace(object sender, EventArgs e) {
    string workspaceName = (e as WorkspaceEventArgs).Workspace.Name;
    // ...
}
vb
Imports DevExpress.Utils

Private Sub workspaceManager1_BeforeApplyWorkspace(ByVal sender As Object, ByVal e As EventArgs)
    Dim workspaceName As String = (TryCast(e, WorkspaceEventArgs)).Workspace.Name
  ' ...
End Sub

See Also

AfterApplyWorkspace

ApplyWorkspace(String)

WorkspaceManager Class

WorkspaceManager Members

DevExpress.Utils Namespace