I have two ultrawingrid with drag n drop functionality. Everything is working perfectly except that when the user attempts to drag the horizontal scrollbar on the grid, the drag n drop operation starts and the user can't scroll the grid (via dragging the scrollbar). I start the drag and drop operation in the grid_MouseMove event. It calls the grid.DoDragDrop method.
My question is, what would be the best way to tell at that point whether the user is actually scrolling the grid?
I tried setting a flag in the "BeforeColRegionScroll" and "AfterColRegionScroll", then check that flag in the grid_MouseMove but it didn't work properly.
I noticed I can see the underlying UIElement by going to Grid.DisplayLayout.UIElement.ElementWithMouseCapture, but there must be a better way?
What would be the best/easy way to tell during the MouseMove event whether the user is scrolling the grid via the scrollbar?
Thanks
There are a whole bunch of articles in the Infragistics KB about how to determine what part of the grid the mouse is over using UIElements. Do a search in the KB for ElementFromPoint.
Knowledge Base Results
Thanks Mike,
I knew about the ElementFromPoint but was hoping there was a cleaner/easier way to determine if the user was scrolling the grid. I figured somewhere in the labyrinth of grid properties there was an IsScrolling property.
BeforeColRegionScroll -> set _bIsScrolling = true;
MouseUp -> set _bIsScrolling = false;
Then test this in the MouseMove event.
Maybe not the best way, but appears to work without drilling into the UIElement.
There's no IsScrolling property as far as I know. You migth try looking at the CurrentState (or maybe it's just State) property of the grid. But I don't think this has a scrolling state either.
There are scrolling events like Before/AfterRowRegionScroll and Before/AfterCoplRegionScroll. Maybe you could just set flags inside those events.