From the course: Windows Presentation Foundation: 1 Build Dramatic Desktop Applications

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Write the interaction code for the application

Write the interaction code for the application

From the course: Windows Presentation Foundation: 1 Build Dramatic Desktop Applications

Start my 1-month free trial

Write the interaction code for the application

- [Instructor] At some point, you'll need to write some interaction logic in your application. So when the user clicks on a Button, or selects an item in a menu, or chooses something in a ListBox, you execute some code. The way I'm going to implement that in this demo is to use one of the simpler methods, which is to use an event handler and put that event handler in my CodeBehind file. There are other ways of handling this. A common one in WPF is to create a ViewModel class, put the code in the ViewModel class, and then use data binding and something called a command access and execute that code. But for this example, I be putting the code in the CodeBehind and using an event handler. My first step is to carve out some room on this TourStopsView.xaml file. Currently the ListBox is taking up the entire height of the window, and I want to put my Button and a TextBlock on the bottom. The first step is to add two rows to the grid. Click over here, that adds two rows. I'll set the height…

Contents