Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SvgImageBox.ItemClick Event

Occurs when a user clicks an SvgImageItem in the SvgImageBox.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.Utils.v24.2.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