开发者

Button Click Callbacks

开发者 https://www.devze.com 2023-01-06 19:29 出处:网络
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 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

精彩评论

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

关注公众号