Skip to main content
All docs
V26.1
  • DataViewBase.ColumnDragOver Event

    Occurs when a user drags a column or band over a drop target.

    Namespace: DevExpress.Xpf.Grid

    Assembly: DevExpress.Xpf.Grid.v26.1.Core.dll

    Declaration

    public event ColumnDragOverEventHandler ColumnDragOver

    Event Data

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

    Property Description
    Cancel Gets or sets whether the event should be canceled. Inherited from CancelRoutedEventArgs.
    Handled Gets 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.
    OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
    RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
    Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.
    SourceArea Gets the source area where the drag operation started.
    SourceBand Gets the source band where the drag operation started.
    SourceBandIndex Gets the index of the source band where the drag operation started.
    SourceBandRowIndex Gets the row index of the source band where the drag operation started.
    SourceColumn Gets the source column or band where the drag operation started.
    SourceIndex Gets the index of the source column or band where the drag operation started.
    SourceView Gets the source view where the drag operation started.
    TargetArea Gets the target area where the dragged item is about to be dropped.
    TargetBand Gets the target band where the dragged item is about to be dropped.
    TargetBandIndex Gets the index of the target band where the dragged item is about to be dropped.
    TargetBandRowIndex Gets the row index of the target band where the dragged item is about to be dropped.
    TargetColumn Gets the target column or band where the dragged item is about to be dropped.
    TargetIndex Gets the index of the target column or band where the dragged item is about to be dropped.

    The event data class exposes the following methods:

    Method Description
    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

    Handle the ColumnDragOver event to modify predefined behavior for column and band drag & drop operations. The ColumnDragOverEventArgs class includes parameters that allow you to modify drag & drop functionality within a ColumnDragOver event handler.

    <ThemedWindow ...
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" >
    
        <dxg:GridControl ItemsSource="{Binding Items}">
            <dxg:GridControl.Columns>
                <dxg:GridColumn FieldName="ID" />
                <dxg:GridColumn FieldName="Name" />
                <dxg:GridColumn FieldName="Date" />
            </dxg:GridControl.Columns>
            <dxg:GridControl.View>
                <dxg:TableView ColumnDragOver="TableView_ColumnDragOver" />
            </dxg:GridControl.View>
        </dxg:GridControl>
    </ThemedWindow>
    
    private void TableView_ColumnDragOver(object sender, ColumnDragOverEventArgs e) {
        if (e.TargetArea == HeaderArea.ColumnHeader) {
            e.Cancel = true;
        }
    }
    
    See Also