Home Forums WinForms controls Xceed Grid for WinForms Drag/drop events in custom CellViewerManager and CellEditorManager Reply To: Drag/drop events in custom CellViewerManager and CellEditorManager

User (Old forums)
Member
Post count: 23064

The columns in my grid are created at runtime. Furthermore not every row in a column has the same CellEditorManager, and these too are set at runtime. So subscribing to the ActivatingControl and DeactivatingControl events of the CellEditorManager when the column is created, let alone when the form loads, will not work for me. Just as an experiment I tried subscribing on column creation, and neither Activating nor Deactivating fired, which is what I expected.

Instead I subscribed to the events when the Cell was populated and its CellEditorManager was set, like so:

         private void setViewer( Cell pxCell )
        {
            if( needsCustomEditor( pxCell ) )
            {
                        pxCell.CellViewerManager = new CustomViewer();
                        pxCell.ReadOnly = false;
                        pxCell.CellEditorManager = getCustomEditor();
                        pxCell.CellEditorDisplayConditions = CellEditorDisplayConditions.MouseOverCell;
                }
            }
        }

 

        private CellEditorManager getCustomEditor()
        {
            CustomEditor editor = new CustomEditor();
            editor.ActivatingControl += new CellEditorEventHandler( editor_ActivatingControl );
            editor.DeactivatingControl += new CellEditorEventHandler( editor_DeactivatingControl );
            return editor;
        }

 

Inside editor_ActivatingControl and editor_DeactivatingControl I subscribe (and unsubscribe) to DragEnter and DragDrop, as shown in my previous post. In this scheme ActivatingControl and DeactivatingControl fire as expected. But DragEnter and DrapDrop do not fire.

A couple more points that may be significant. The grid in question is a DetailGrid. MouseClick and MouseDoubleClick are both subscribed to in the initialization code of the DetailGrid (as well as the parent), and they both fire exactly as you would expect them to. So this problem seems to pertain to drag events in particular. 

Aaron

 

 

 

Imported from legacy forums. Posted by Aaron (had 4062 views)