At some point in the application life cycle, the app needs to react to the user input. In XAML some of this interaction is definable in XAML. There are times when only code will do however. This tutorial shows how to create an event handler in the XAML co
- [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 of this to two units,…and the height of this row to one unit.…
- Why choose Windows Presentation Foundation?
- Exploring the project types
- Creating a WPF project in Visual Studio
- Exploring assemblies and parts
- Using the XAML editor
- Creating the UI, including tabs, details, and controls
- Using data binding
- Adding styles
- Writing interaction code
- Using control templates, 3D parts, and effects
Skill Level Intermediate
Learning Visual Studio Team Serviceswith Jose Miguel Rady Allende1h 17m Intermediate
2. Create a WPF Application
3. Create the UI
4. Examples and Concepts
Next steps1m 37s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.