Version

Fix Records

You can programmatically fix records at run time regardless of a FieldLayoutSettings object’s AllowRecordFixing property value. You can fix a Record object by setting its FixedLocation property to a FixedRecordLocation enum value or by executing one of the following commands exposed by the DataPresenterCommands class:

  • FixRecordBottom

  • FixRecordTop

  • UnfixRecord

xamDataPresenter Fix Records 01.png

The following example code demonstrates how to fix a record. All three commands require you to pass in a Record object as a command parameter. The XAML binds the CommandParameter property of the Button control to the DataPresenter control’s ActiveRecord property.

In XAML:

<Button
    Content="Fix the Active Record"
    Command="{x:Static igDP:DataPresenterCommands.FixRecordTop}"
    CommandTarget="{Binding ElementName=xamDataPresenter1}"
    CommandParameter="{Binding ElementName=xamDataPresenter1, Path=ActiveRecord}"/>
<igDP:XamDataPresenter Name="xamDataPresenter1" BindToSampleData="True">
</igDP:XamDataPresenter>

In Visual Basic:

Imports Infragistics.Windows.DataPresenter
...
'Me.xamDataPresenter1.Records(0).FixedLocation = FixedRecordLocation.FixedToTop
Me.xamDataPresenter1.ExecuteCommand(DataPresenterCommands.FixRecordTop, Me.xamDataPresenter1.ActiveRecord)
...

In C#:

using Infragistics.Windows.DataPresenter;
...
//this.xamDataPresenter1.Records[0].FixedLocation = FixedRecordLocation.FixedToTop;
this.xamDataPresenter1.ExecuteCommand(DataPresenterCommands.FixRecordTop, this.xamDataPresenter1.ActiveRecord);
...