Cannot implicitly convert type 'MouseEventHandler' to 'RoutedEventHandler
I tried to inherit method button1_click and I got the message above, how to fix that ?
namespace visualinheritance
{
    public partial class usercontrolcommon : UserControl
    {
        public usercontrolcommon()
        {
            InitializeComponent();
        }
        public void button1_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("usercontrolcommon");
        }
    }
}
namespace visualinheritance
{
    public partial class usercontrol1 : usercontrolcommon
    {
        public usercontrol1()
        {
            InitializeComponent(开发者_Go百科);
            this.button1.Click += new MouseEventHandler(button1_Click);
        }
    }
}
The button click event is not a mouse event.  Just change the handler to button1.Click += button1_Click; and it will work
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论