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
From the course: Windows Presentation Foundation: 1 Build Dramatic Desktop Applications
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Create the basic tab layout10m 13s
-
Add assets to project3m 26s
-
Change Windows properties4m 40s
-
Add the Details UI9m 10s
-
Build UI from user controls4m 4s
-
Add user controls to the main UI2m 55s
-
Use databinding to present the data5m 7s
-
Use a data template to enhance the UI5m 26s
-
Use MarkupExtension and template4m 19s
-
Add styles to elements4m 30s
-
Write the interaction code for the application6m 57s
-
UI summary2m 4s
-
-
-