Version

RefreshSortPosition Method

If the record is not at the correct sort position in the record collection, this method will reposition it at the correct sort position based on the current sort criteria. Also if the record is in the wrong group record, it will be moved to the correct group record.
Syntax
'Declaration
 
Public Overridable Sub RefreshSortPosition() 
public virtual void RefreshSortPosition()
Remarks

This method can be useful in situations where a new record is added, which by default is appended at the end of the collection, and you want to ensure the record is positioned at the correct location in the collection based on the sort criteria without having to resort the whole record collection. This method should not be used if the sort criteria itself changes which affects the whole record collection.

To resort all the records of a record collection, call RecordManager's Sorted.RefreshSort method.

Note: This method will only work properly if all other sibling records are in the correct sort order. It is normally called asynchronously from within the DataPresenterBase.InitializeRecordEvent using Dispatcher.BeginInvoke especially if the record is being added, in which case it should only be called asynchronously. However, when changing multiple records via code then calling this method asynchronously for each changed records will result in an unpredictable sort order since there are multiple records out of order by the time this method is called. In this case this method should be called synchronously after each record is changed or RecordManager's Sorted.RefreshSort method should be called after all the records have been changed.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also