In a Windows phone application, I want to add a button dynamically, as shown below:
Button btn = new Button(); btn.Content = tb_groupname.Text; btn.Width = 200; btn.Height = 200; btn.Click += new EventHandler(btn_Click);
But when I add a click event on my button, I get below the error:
Cannot implicitly convert type 'System.EventHandler' to 'System.Windows.RoutedEventHandler'
The following is the button click event method:
private void btn_Click(object sender, EventArgs e) { textbox1.text = "ABC";
I do not understand why he received this error. Please offer me, waiting for an answer. Thanks.
source share