0

I need to inherit for ComboBox in order to add a new event OnSelectedValueChanging(). This event should be triggered when the user is attempting to change the current selected value of the combo box. This event also should be cancellable (the user has the ability to use e.cancel as in the FormClosing event for example)

public  class SUIComboBox : UIComboBox
{
    /// <summary>
    /// The prevously selected value
    /// </summary>
    private object _PreviousSelectedValue = null;

    public event EventHandler<EventArgs> SelectedValueChanging;

    protected virtual void OnSelectedValueChanging(object sender, CancelEventArgs e)
    {
        var handler = SelectedValueChanging; 
        handler?.Invoke(sender, e);
    }
}

public class SelectedValueChangingEventArgs : CancelEventArgs
{

}
Robert
  • 2,407
  • 1
  • 24
  • 35
Hassan Shouman
  • 275
  • 4
  • 13

0 Answers0