Q:

Wpf without event handlers

Edit:  I misread the assignment....  No event handlers because he doesn't want us working ahead, we're just to bind a set of data to controls to be displayed.
Small issue with homework in wpf.  We're building on a program each work, we're on binding right now.  The user enters data into a textbox, and it displays two sets of data into two datagrids.  Right now, what is displayed is hard coded instead of it pulling from a database.  I can get it to display the data and I can get it to display the correct data based on the textbox input, but we're not allowed to use event handlers.  So how can a button click be read without an event handler for it?
I can bind the textbox and the window's title so it changes as the text is changed within the textbox, but I can't get what is in the textbox.  It's possible I've overlooked something in the book, but I don't see how this is possible without event handlers for the button at least.

A:

If you are not allowed to use events and are required to use a button in your interface, then commands are definitely the way to go.
Actually commands are the prefered solution for interaction over events since the release of WPF. As I am mostly developing using MVVM, I can't remember the last time I hooked on a button event.
Also every other way of linking your button to an interaction would be a dirty hack.
Maybe it is a bit of a step forward into your courses, but still it worth reading: http://msdn.microsoft.com/en-gb/magazine/cc785480.aspx

