All docs
V20.1
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

SvgImageBox.SelectionChanging Event

Fires when the item selection is about to be changed. Allows you to cancel the current operation.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.Utils.v20.1.dll

Declaration

public event SvgImageSelectionChangingEventHandler SelectionChanging
Public Event SelectionChanging As SvgImageSelectionChangingEventHandler

Event Data

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

Property Description
Action Gets or sets how the selected item collection has been changed.
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
Item Gets or sets the currently processed item.

Remarks

The event's Item parameter specifies the item whose selected state is about to be changed. Use the Action parameter to identify the item's new state.

If all items are deselected at once (the [SvgImageBox.Selection](xref:DevExpress.XtraEditors.SvgImageBox.Selection collection is cleared), the Item parameter returns null and the Action parameter returns Clear.

To prevent an item's selected state from being changed, set the event's Cancel parameter to true.

Example

This example shows how to handle the SelectionChanging event to prevent the current selection from being changed.

private void svgImageBox1_SelectionChanging(object sender, DevExpress.XtraEditors.SvgImageSelectionChangingEventArgs e) {
    //Prevent item selection from being cleared when a user clicks on the empty space
    if (e.Action == DevExpress.XtraEditors.SvgImageSelectionChangeAction.Clear) {
        e.Cancel = true;
        return;
    }

    //Prevent an item from being selected/deselected.
    if (e.Item == svgImageBox1.HoveredItem) {
        e.Cancel = true;
        return;
    }
}
See Also