DataSourceAllowsDelete Property

Returns true if the data source supports deleting records (read-only)
Public ReadOnly Property DataSourceAllowsDelete As Boolean
public bool DataSourceAllowsDelete {get;}

Deleting DataRecords is supported for DataPresenterBase.DataSources that implement the System.ComponentModel.IBindingList interface and return true from its System.ComponentModel.IBindingList.AllowRemove property. It is also supported for DataPresenterBase.DataSources that only implement the System.Collections.IList interface and return false from both its System.Collections.IList.IsReadOnly and System.Collections.IList.IsFixedSize properties.

Assuming deleting of DataRecords is enabled then when the user selects one or more DataRecords and presses the Delete key the DataPresenterBase.RecordsDeleting and DataPresenterBase.RecordsDeleted events will be raised. DataRecords can also be deleted programmatically by first selecting them (via the Record.IsSelected property or the DataPresenterBase.SelectedItems collection) and then calling DataPresenterBase.ExecuteCommand with the DataPresenterCommands.DeleteSelectedDataRecords command.

Note: Deleting records is enabled by default. To disable deleting records set the FieldLayoutSettings's AllowDelete property to false.


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