开发者

Button Click Callbacks

I have a couple of user controls that are loaded at runtime that contain a bunch of buttons. I register those button click events in my data class by getting a reference to the user control. This is how I'm doing it now in my data class:

MainWindow.Instance.Menu1Instance.Button1.Click += new RoutedEventHandler(Button1_Click开发者_Go百科);

Problem is I'm going to have several user controls that need references and it seems kind of tedious. I was wondering if there was a better way of doing this?


You could use data binding, see ICommand is like a chocolate cake.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜