-1

I've this code that I've found on this community , In fact, this code will create a custom event ValueChangedEventHandler for usercontrol , let's suppose that I've a custom NumericBox and I would like to create a TextChangedEventHandler ,

how can I achieve this ?

public delegate void ValueChangedEventHandler(object sender, ValueChangedEventArgs e);
public partial class SampleUserControl : UserControl
{    
    public SampleUserControl() 
    { 
        InitializeComponent(); 
    }

    // Declare an event 
    public event ValueChangedEventHandler ValueChanged;

    protected virtual void OnValueChanged(ValueChangedEventArgs e) 
    { 
        if (ValueChanged != null) 
            ValueChanged(this,e); 
    }    
  
}

0 Answers0