I am trying to figure out what events are raised when Column Headers are dragged around.
I tried to capture the Preview[ DragEnter, Drop DragOver] etc events on the XamDatagrid, but none of them seem to fire.
Reason why I think I need to capture the events:
We have a concept of Column groups within our application, I want to be able to support drag and drop of columns between the groups themselves, or drag and drop the entire group around, but columns in one group should not be dropped in another group.
Any Ideas/Pointers around this problem would be highly appreciated.
Quick Note:
If I set the AllowDrop attribute to true, I do see events being fired, but not for the column move actions.
The event that I was trying to look for was FieldPositionChanging.
I know I can cancel the event by setting e.Cancel = true, but is there a way I can provide a UI cue that the move is invalid.
Hello,
To the best of my knowledge, this is handled internally by a Field Drag Manager and drag-drop events will not fire. FieldPositionChanging/ed are the events that will fire, and of course PreviewMouseLeftButtonDown and PreviewMouseMove, which probably you can use.
FieldPositionChanging event tells me which column is being moved, but I cannot figure out a way to determine the drop location, any ideas as to how I could possibly handle this?
If I can determine the drop location then I might be able to cancel the event based on business logic.
As I said in my previous post - PreviewMouseMove and traverse the element tree and get the label presenter underneath the mouse pointer.
How does one programatically move columns, when there are column headers spanning multiple columns?
My Grid layout has column headers spread across 2 rows, the top row serves as the group header for a set of columns defined under it.In the FieldPositionChanged event I check if the field being moved is header i.e from row 0, Then I want to move the set of columns under it to the same index as the header.
I tried using the Move() fn on FieldCollection but that doesn't work. Following a post on moving columns I even clear off the FieldPosition Customizations grid.ClearCustomizations(CustomizationType.FieldPosition)]
but my columns stay put, the field collection is actually updated when I inspect the collection in a debugger, but the layout does not change.
Any pointers would be greatly appreciated.