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.
精彩评论