Version

SelectedDataItems Property

Gets/sets an array of data items associated with the records in the SelectedItems.Records or SelectedItems.Cells collection
Syntax
'Declaration
 
Public Property SelectedDataItems As Object()
public object[] SelectedDataItems {get; set;}

Property Value

An array containing the data items of the selected records, or selected cells or null.
Remarks

This property is exposed as an object array (instead of IEnumerable or IList) so that there should be no confusion about its behavior. When the selection changes a new object array is created (as an atomic operation) from the SelectedItems.Records or SelectedItems.Cells collection (based on SelectedDataItemsScope) and set on this property. The DataRecord.DataItem of each DataRecord in that collection is used to popluate the new array. To change the record selection an application can set this property (either explicitly or through a binding) to a new array of its data items. This will change the record selection even if the SelectedDataItemsScope property is 'None', which is its default setting.

To synchronize the selectiion and activation of 2 XamDataGrids bind the ActiveDataItem and SelectedDataItems properties of one to the other and set the SelectedDataItemsScope property on each grid to either 'RecordsOnly' or 'RecordsOrCells'.

Note: if the SelectedDataItemsScope is not set to a value other than 'None' then the SelectedDataItems property is not set when the selection changes. Just like ActiveDataItem, SelectedDataItems binds 2-way by default.

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