From ef4a415b84ac4ce9b145db9d723701a0099ce0f1 Mon Sep 17 00:00:00 2001 From: Cocotteseb Date: Sat, 5 Dec 2015 17:38:11 +0100 Subject: [PATCH] Added KryptonMenuImageSelect click event Useful in the condtionnal formatting menu of KryptonOutlookGrid --- .../KryptonContextMenuImageSelect.cs | 20 +++++++++++++++++++ .../View Draw/ViewDrawMenuImageSelectItem.cs | 3 +++ 2 files changed, 23 insertions(+) diff --git a/Source/Krypton Components/ComponentFactory.Krypton.Toolkit/ContextMenu/KryptonContextMenuImageSelect.cs b/Source/Krypton Components/ComponentFactory.Krypton.Toolkit/ContextMenu/KryptonContextMenuImageSelect.cs index 9be03de6..23b6db58 100644 --- a/Source/Krypton Components/ComponentFactory.Krypton.Toolkit/ContextMenu/KryptonContextMenuImageSelect.cs +++ b/Source/Krypton Components/ComponentFactory.Krypton.Toolkit/ContextMenu/KryptonContextMenuImageSelect.cs @@ -64,6 +64,14 @@ public class KryptonContextMenuImageSelect : KryptonContextMenuItemBase [Category("Action")] [Description("Occurs when user is tracking over an image.")] public event EventHandler TrackingImage; + + /// + /// Occurs when the value of the SelectedIndex property changes. + /// + [Category("Action")] + [Description("Occurs when an image is clicked.")] + public event EventHandler Click; + #endregion #region Identity @@ -340,6 +348,18 @@ protected virtual void OnTrackingImage(ImageSelectEventArgs e) if (TrackingImage != null) TrackingImage(this, e); } + + /// + /// Raises the Click event. + /// + /// An EventArgs that contains the event data. + internal virtual void OnClick(EventArgs e) + { + if (Click != null) + Click(this, e); + } + + #endregion #region Internal diff --git a/Source/Krypton Components/ComponentFactory.Krypton.Toolkit/View Draw/ViewDrawMenuImageSelectItem.cs b/Source/Krypton Components/ComponentFactory.Krypton.Toolkit/View Draw/ViewDrawMenuImageSelectItem.cs index 4a506452..2cf6f952 100644 --- a/Source/Krypton Components/ComponentFactory.Krypton.Toolkit/View Draw/ViewDrawMenuImageSelectItem.cs +++ b/Source/Krypton Components/ComponentFactory.Krypton.Toolkit/View Draw/ViewDrawMenuImageSelectItem.cs @@ -202,6 +202,9 @@ private void OnItemClick(object sender, MouseEventArgs e) // Set new selection index _imageSelect.SelectedIndex = _imageIndex; + //Fire a click item event : seb the right way ?? after selected index + _imageSelect.OnClick(e); + // Should we automatically try and close the context menu stack if (_imageSelect.AutoClose) {