Skip to main content

SvgImageBox.ItemClick Event

Occurs when a user clicks an SvgImageItem in the SvgImageBox.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.Utils.v24.1.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public event SvgImageItemMouseEventHandler ItemClick

Event Data

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

Property Description
Button Gets the pressed mouse button.
Handled Gets or sets whether to manually process item clicks.
Item Gets the currently processed item. Inherited from SvgImageItemEventArgs.
Location Gets the mouse location relative to the control’s top left corner.
X Gets the mouse x-coordinate relative to the control’s top left corner.
Y Gets the mouse y-coordinate relative to the control’s top left corner.

Remarks

The following code sample changes the item’s color when a user right-clicks it. The second right-click returns the initial color:

WinForms SvgImageBox - ItemClick Event

void OnItemClick(object sender, DevExpress.XtraEditors.SvgImageItemMouseEventArgs e) {
    var fillColor = Color.Green;
    if (e.Button == MouseButtons.Right) {
        if (e.Item.Appearance.Normal.FillColor == fillColor)
            e.Item.Appearance.Normal.Reset();
        else
            e.Item.Appearance.Normal.FillColor = fillColor;
    }
}
See Also