'宣言 Public ReadOnly Property DragAction As PaneDragAction
public PaneDragAction DragAction {get;}
Imports Infragistics.Windows.DockManager Imports Infragistics.Windows.DockManager.Dragging Imports Infragistics.Windows.DockManager.Events Private Sub XamDockManager_PaneDragOver(ByVal sender As Object, ByVal e As PaneDragOverEventArgs) ' note: this event is only fired once for each unique ' pane drag action. ' the drag action provides information about the type ' of action that will occur. the property is of the ' base class - PaneDragAction - so you need to upcast ' to the appropriate type to get additional information ' If TypeOf e.DragAction Is FloatPaneAction Then ' here we are preventing a drag operation from ' changing a docked pane into a new floating pane. ' the same effect would have been accomplished if ' the AllowDockingFloating of one or more of the ' panes in the e.Panes had been set to false. e.IsValidDragAction = False ' note: by default this event will only fire for ' valid drop locations. if you need to receive this ' event for locations that are not valid (e.g. based ' on properties of the pane(s) being dragged such as ' the AllowDocking(Left|Right|Top|Bottom) properties) ' then you need to set the ' RaisePaneDragOverForInvalidLocations property of the ' event args for the PaneDragStarting to true. ' 'e.IsValidDragAction = true; Else End If Dim sb As New System.Text.StringBuilder() sb.Append(e.DragAction.ToString()) sb.Append(": ") ' you can see the panes that are being dragged For Each pane As ContentPane In e.Panes sb.Append(pane.Header) sb.Append(",") Next System.Diagnostics.Debug.WriteLine(sb.ToString(), "PaneDragOver") ' the cursor property can be used to override the default ' valid/invalid drop cursor that was specified in the ' panedragstarting event. If e.IsValidDragAction = False Then e.Cursor = Cursors.No End If ' mark the event handled so it doesn't keep bubbling ' up the element tree e.Handled = True End Sub
using Infragistics.Windows.DockManager; using Infragistics.Windows.DockManager.Dragging; using Infragistics.Windows.DockManager.Events; private void XamDockManager_PaneDragOver(object sender, PaneDragOverEventArgs e) { // note: this event is only fired once for each unique // pane drag action. // the drag action provides information about the type // of action that will occur. the property is of the // base class - PaneDragAction - so you need to upcast // to the appropriate type to get additional information // if (e.DragAction is FloatPaneAction) { // here we are preventing a drag operation from // changing a docked pane into a new floating pane. // the same effect would have been accomplished if // the AllowDockingFloating of one or more of the // panes in the e.Panes had been set to false. e.IsValidDragAction = false; } else { // note: by default this event will only fire for // valid drop locations. if you need to receive this // event for locations that are not valid (e.g. based // on properties of the pane(s) being dragged such as // the AllowDocking(Left|Right|Top|Bottom) properties) // then you need to set the // RaisePaneDragOverForInvalidLocations property of the // event args for the PaneDragStarting to true. // //e.IsValidDragAction = true; } System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(e.DragAction.ToString()); sb.Append(": "); // you can see the panes that are being dragged foreach (ContentPane pane in e.Panes) { sb.Append(pane.Header); sb.Append(","); } System.Diagnostics.Debug.WriteLine(sb.ToString(), "PaneDragOver"); // the cursor property can be used to override the default // valid/invalid drop cursor that was specified in the // panedragstarting event. if (e.IsValidDragAction == false) e.Cursor = Cursors.No; // mark the event handled so it doesn't keep bubbling // up the element tree e.Handled = true; }