Once a template is defined, use the StaticResource markup extension to apply the template to the bound data.
- [Host] I've defined a data template for my list box.…You'll see it here on line 12.…I set the item template and I've defined this data template.…And it's not a bad looking data template.…It's got a stack panel, it's got an image and a text box.…But my finished UI for this application…is much more sophisticated than that.…I need a tour stop,…I need a checkbox,…I need multiple text blocks…and I need to arrange them in a more artful fashion…on this screen.…What I can do is pick somebody on our team…that's got a good design sense,…and have them build a data template.…
We might even be lucky enough to have…a designer on our team…that can build this template for us.…Now, instead of taking the template…and putting it here inside the list box,…we should build this template in a reusable fashion.…You know how when you're writing code…if you find yourself writing the same code…more than one place?…You want to refactor it and put in a common method.…Well, it's the same in XAML.…If you use the same data template…on three different list boxes…
- 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.