This is a migrated thread and some comments may be shown as answers.

[Solved] How to get access to GridViewHeaderCell.ColumnIsResizing property?

1 Answer 165 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rob
Top achievements
Rank 1
Rob asked on 07 Feb 2011, 11:02 PM
Hello,

I have discovered a problem in my application that uses a RadGridView.  In my app, I am able to drag GridViewColumnHeaders from the grid onto another area where we build charts...  I have attached the following drag code to the gridview:
RadDragAndDropManager.AddDragQueryHandler(rgv, OnGridViewDragQuery);
  
private void OnGridViewDragQuery(object sender, DragDropQueryEventArgs e)
{
    //Fired by RadGridView to say "Something is being dragged on me..." - The item being dragged might
   //be a 'GridViewHeaderCell' or a 'GridViewGroupPanelItem'.
  
   //Check if this is a 'GridViewGroupPanelItem' first and let the dragging continue...
   var GroupPanelCell = e.Options.Source as GridViewGroupPanelCell;
   if (GroupPanelCell != null)
   {
      e.QueryResult = true;
      return;
   }
  
   //Check if this is a 'GridViewHeaderCell' and it can be dragged...
   var ColumnHeader = e.Options.Source as GridViewHeaderCell;
   if (ColumnHeader == null || ColumnHeader.Column.DisplayIndex < 2)
   //if (ColumnHeader == null || ColumnHeader.Column.DisplayIndex < 2 || ColumnHeader.ColumnIsResizing)
   {
      e.QueryResult = false;
      return;
   }
  
   //put my column header into the payload so some other drop location can grab it...
   e.Options.Payload = sysColumnName;
   e.QueryResult = true;
   e.Handled = false;
  
}


The problem can be seen by running the app, scrolling the grid to somewhere in the middle (vertically), and then resizing one of the columns.  As you resize the column width, it runs through this dragquery and since you have "grabbed" a GridViewColumnHeader, it scrolls the grid because it's trying to let you drop it (I believe)...  if i was able to get to the "ColumnIsResizing" property (which in this case would be true) then I could fall out of the code in the middle if statement and there wouldn't be a problem ...

1 Answer, 1 is accepted

Sort by
0
Rob
Top achievements
Rank 1
answered on 08 Feb 2011, 03:06 PM
I have managed to get around this by setting a local variable 'IsColumnResizing=true' in the 'ColumnWidthChanging' event, and then unsetting it to false in the 'ColumnWidthChanged' event...  This is not the most ideal and I would still like to have the 'ColumnIsResizing' property available at the GridViewHeaderCell level...
Tags
GridView
Asked by
Rob
Top achievements
Rank 1
Answers by
Rob
Top achievements
Rank 1
Share this question
or