Back to Devexpress

DockLayoutManager.DockOperationStarting Event

wpf-devexpress-dot-xpf-dot-docking-dot-docklayoutmanager-83558dd7.md

latest6.9 KB
Original Source

DockLayoutManager.DockOperationStarting Event

Occurs whenever a docking operation within the current DockLayoutManager is performed.

Namespace : DevExpress.Xpf.Docking

Assembly : DevExpress.Xpf.Docking.v25.2.dll

NuGet Package : DevExpress.Wpf.Docking

Declaration

csharp
public event DockOperationStartingEventHandler DockOperationStarting
vb
Public Event DockOperationStarting As DockOperationStartingEventHandler

Event Data

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

PropertyDescription
CancelGets or sets whether the current operation must be canceled. Inherited from ItemCancelEventArgs.
DockOperationGets the type of an operation that is processed within the DockLayoutManager.DockOperationStarting event.
DockTargetGets a Dock Item to which the current Dock Item is to be docked.
HandledGets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
ItemGets the currently processed item. Inherited from ItemEventArgs.
OriginalSourceGets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEventGets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
SourceGets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.

The event data class exposes the following methods:

MethodDescription
InvokeEventHandler(Delegate, Object)When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object)When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.

Remarks

The DockOperationStarting event is fired when a Dock Item within the current DockLayoutManager is to be docked, auto-hidden, closed, restored or made floating. Handling this event allows you to enable or cancel certain upcoming layout modifications.

The DockOperationStarting event receives an argument of the DockOperationStartingEventArgs type. Its properties allow you to determine which Dock Item is being modified, what type of operation is going to happen, and depending on this information, allow or prohibit the current operation. For example, the following code prohibits the dockPanel2 from being docked via a double mouse click on its header:

csharp
private void WindowContainer_DockOperationStarting(object sender, DevExpress.Xpf.Docking.Base.DockOperationStartingEventArgs e) {
    if (e.Item == dockPanel2 && e.DockOperation == DevExpress.Xpf.Docking.DockOperation.Dock && e.DockTarget == null) e.Cancel = true;
}
vb
Private Sub WindowContainer_DockOperationStarting(ByVal sender As Object, ByVal e As DevExpress.Xpf.Docking.Base.DockOperationStartingEventArgs)
    If e.Item = dockPanel2 AndAlso e.DockOperation = DevExpress.Xpf.Docking.DockOperation.Dock AndAlso e.DockTarget Is Nothing Then
    e.Cancel = True
    End If
End Sub

If the DockOperationStarting event is not canceled, it’s followed by the DockLayoutManager.DockOperationCompleted event.

See Also

DockOperationCompleted

DockLayoutManager Class

DockLayoutManager Members

DevExpress.Xpf.Docking Namespace