Some WPF elements like the ListBox and ComboBox use a panel to layout the data shown in the list. This video shows how to use a template to swap out the default panel and replace it with the custom panel.
- [Narrator] One of my favorite features of WPF…is the idea of a template.…A template allows me to take some UI,…let's say a control UI or some data,…and I can specify a set of WPF elements,…put them inside a template,…and then I can tell WPF…to use the template to render the data…or the template to replace the default UI…for a control template.…And what I'm showing you in this example…is how to replace the layout panel…that's part of a listbox.…
In this example, I have a window with a listbox…named VegetableListBox…which contains a number of TextBlocks.…And then I have a button and an empty TextBlock here.…And the idea is that when you click on the button…we'll find out whether there's anything…selected in the listbox,…and if so, I'll output the text in the listbox.…So, it looks like this.…Pick the item, click on the button,…and it shows the results here.…Let's pick another item, click on the button.…So that's the basics, a really simple application.…
Now here's the thing about the listbox.…This UI here, these items that are being rendered,…
- Exploring the layout panels
- Working with the grid
- Adding rows and columns
- Creating scrolling content
- Controlling element visibility
- Aligning content
- Making custom layout panels
Skill Level Intermediate
Learning Visual Studio Team Serviceswith Jose Miguel Rady Allende1h 17m Intermediate
1. Layout Panels
2. Other Layout Concepts
3. Custom Layout Panel
Next steps1m 34s
- 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.