Back to Devexpress

LookUpEdit.SelectionChanging Event

windowsforms-devexpress-dot-xtraeditors-dot-lookupedit-6821d28c.md

latest2.4 KB
Original Source

LookUpEdit.SelectionChanging Event

Occurs before a user selects an item in the editor’s popup. This event works in Multiple Item Selection mode only.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event EventHandler<PopupSelectionChangingEventArgs> SelectionChanging
vb
<DXCategory("Events")>
Public Event SelectionChanging As EventHandler(Of PopupSelectionChangingEventArgs)

Event Data

The SelectionChanging event's data class is PopupSelectionChangingEventArgs. The following properties provide information specific to this event:

PropertyDescription
CancelGets or sets whether to cancel the change selection operation.
IsSelectedGets whether the item is selected.

Remarks

The SelectionChanging event allows you to retain the item’s selected state. The following code sample does not allow users to toggle the first item’s selection:

csharp
private void lookUpEdit1_SelectionChanging(object sender, DevExpress.XtraEditors.Controls.PopupSelectionChangingEventArgs e) {
    e.Cancel = e.RecordIndex == 0;
}
vb
Private Sub lookUpEdit1_SelectionChanging(ByVal sender As Object, ByVal e As DevExpress.XtraEditors.Controls.PopupSelectionChangingEventArgs)
    e.Cancel = e.RecordIndex = 0
End Sub

See Also

SelectionChanged

LookUpEdit Class

LookUpEdit Members

DevExpress.XtraEditors Namespace