<igDP:XamDataGrid Name="xamDataGrid1" BindToSampleData="True"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AllowFieldMoving="No" /> </igDP:XamDataGrid.FieldLayoutSettings> </igDP:XamDataGrid>
The xamDataGrid™ control allows your end users to move fields around at run time. For example, if your end users need to reorganize the fields in a field layout, they can drag a field and drop it in a different location relative to the other fields within the same field layout; they can even stack fields vertically on top of each other. If you want to modify this behavior, you can set the AllowFieldMoving property of a FieldLayoutSettings object to an AllowFieldMoving enumeration value.
The control raises events like FieldPositionChanging and FieldPositionChanged for a UI triggered change. This means that these events will fire when your end user changes the position of a field, but will not fire if the change is done by you in code.
By default, xamDataGrid enables field moving; however, you can disable field moving by setting the AllowFieldMoving property of a FieldLayoutSettings object to AllowFieldMoving.No. You can disable the field-moving feature at the control level, or on individual field layouts. The field layout settings on a field layout will override the field layout settings at the control-level.
The following example code demonstrates how to disable field moving. If you are using a xamDataPresenter™ control with a grid view instead of a xamDataGrid control, you can simply replace references to the xamDataGrid control in the example code.
In XAML:
<igDP:XamDataGrid Name="xamDataGrid1" BindToSampleData="True"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AllowFieldMoving="No" /> </igDP:XamDataGrid.FieldLayoutSettings> </igDP:XamDataGrid>
In Visual Basic:
Imports Infragistics.Windows.DataPresenter ... Me.xamDataGrid1.FieldLayoutSettings.AllowFieldMoving = AllowFieldMoving.No ...
In C#:
using Infragistics.Windows.DataPresenter; ... this.xamDataGrid1.FieldLayoutSettings.AllowFieldMoving = AllowFieldMoving.No; ...