Version

Enable Data-Value Change Tracking

You can enable data-value change tracking by setting a FieldSettings object’s DataValueChangedNotificationsActive property to True. However, you should only enable this feature on fields that require tracking especially if you need to track a long history of data-value changes.

By default, the DataPresenter controls will only fire the DataValueChanged event for cells that are in view. However, if you want the DataPresenter controls to fire the event even if a cell is not in view, you must set its RecordLoadMode property to PreloadRecords and set the DataValueChangedScope to AllAllocatedRecords. Using this option may affect your application’s performance based on the number of records and the performance of your data source.

Finally, you can modify the number of entries that a cell stores in its value-history list by setting a FieldSettings objects DataValueChangedHistoryLimit property. The default value for the DataValueChangedHistoryLimit property is 1. If you set the value to 0, the ValueHistory property in the DataValueChanged event handler will be NULL.

The following example code demonstrates how to enable data-value change tracking.

In XAML:

<igDP:XamDataPresenter
    Name="xamDataPresenter1"
    BindToSampleData="True"
    DataValueChanged="OnDataValueChanged">
    <igDP:XamDataPresenter.FieldLayouts>
        <igDP:FieldLayout>
            <igDP:FieldLayout.Fields>
                <igDP:Field Name="salary">
                    <igDP:Field.Settings>
                        <igDP:FieldSettings
                            DataValueChangedNotificationsActive="True" />
                    </igDP:Field.Settings>
                </igDP:Field>
            </igDP:FieldLayout.Fields>
        </igDP:FieldLayout>
    </igDP:XamDataPresenter.FieldLayouts>
</igDP:XamDataPresenter>

In Visual Basic:

Imports Infragistics.Windows.DataPresenter.Events
Imports System.Windows.Media
...
Private Sub OnDataValueChanged(ByVal sender As Object, ByVal e As DataValueChangedEventArgs)
    If e.CellValuePresenter IsNot Nothing Then
        'TODO: Add code to give your end users visual feedback on the change.
        e.CellValuePresenter.Foreground = Brushes.Red
    End If
End Sub

In C#:

using Infragistics.Windows.DataPresenter.Events;
using System.Windows.Media;
...
private void OnDataValueChanged(object sender, DataValueChangedEventArgs e)
{
    if (e.CellValuePresenter != null)
    {
        //TODO: Add code to give your end users visual feedback on the change.
        e.CellValuePresenter.Foreground = Brushes.Red;
    }
}