How do I know the target FieldPosition?
The info doesn't seem to exist in the args class.
Hello,
The FieldPositionChanging event fires when you start dragging the Label - this is before the dragging has ended and the position is still unknown. FieldPositionChanged event is fired when the dragging is completed, but that also does not expose the new position. You might want to submit a feature request for this to be added.
The Changing event should fire only when potential drop is about to happen; that is, when the "drop gesture" (the nice animating arrows) is shown.
I hope this is current behavior.
Anyway, at this stage, the new potential position in known, so there should be no problem including it in args.
Please, if you don't mind, open request for adding to both (Changing & Changed).
Regards,
Yaakov
Yaakov,
The user-oriented set of Infragistics events comprise of :
1. Cancellable (-ing) event
2. Completed (-ed) event.
The -ing event is to be cancelled with the e.Cancel=true; before the actual drag starts. The drop is associated with the -ed event.
Note that this event is not only for field moving, but for for changing the position in any manner - pinning, unpinning, etc.
I need to prevent some repositionings. In particular, I want to ensure that the 1st column always stays the first. i.e. no field is positioned to its left.
To do so, I'd need to Cancel the positioning before the field is dropped, and I'd of course need the new target position to decide whether to cancel.
Please report any FR that addresses the scenario.
Sincerely,
OK, didn't realize I had to call that code in FieldPositionChanged handler (tried calling it upon grid construction).
It works.
Thanks,
Please test this with this sample. If you are able to move the first column anywhere else or move another column to the left of the name field, please download the latest service release and give us more details on your environment.. I test this with 9.2.20092.2001 and is working as expected.
It doesn't work.
User can still move fields to the left of the first field.
If you want to keep the first column always first, you can use the following code :
void xamDataGrid1_FieldPositionChanged(object sender, Infragistics.Windows.DataPresenter.Events.FieldPositionChangedEventArgs e)
{
xamDataGrid1.FieldLayouts[0].Fields["CustomerID"].ActualPosition = new FieldPosition(0, 0, 1, 1);
xamDataGrid1.FieldLayouts[0].EnsureUniqueFieldPositions();
}
This way, on every position changed, the CustomerID will be the first one. EnsureUniqueFieldPositions is called to prevernt stacking.