// Create to simulate the UI click public void SimulateClick() { // Make sure that methods is assigned to the event if (Clicked != null) { MyButtonClickEventArgs args = new MyButtonClickEventArgs(); args.Name = "MyButton"; Clicked(this, args); } }
// Method that is called for the event public void CalculatorBtnClicked(object sender, MyButtonClickEventArgs e) { Console.WriteLine($"Caller is a CalculatorButton: {sender is CalculatorButton} and it is named {e.Name}"); }