From the course: XAML Fundamentals: Building Powerful UIs for Cross-Platform Applications
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Make an item selectable with a ListBoxItem - XAML Tutorial
From the course: XAML Fundamentals: Building Powerful UIs for Cross-Platform Applications
Make an item selectable with a ListBoxItem
- [Instructor] Let's revisit some of the XAML we looked at earlier, a couple videos ago. This is the ListBox and it has several text blocks as children. Now, these are in here and the user, because it's in a ListBox, the user can select one of those items when the application's running, and then we can write code to determine which of the items they've selected. Now, think about this. The TextBlock class does not have the notion of selectability. Neither does the StackPanel that's a child of this ListBox, or the ellipse, so where does that come from? Well, that comes from some other classes. One of the classes is the selector class. That's the base class for ListBox. And this is where we can get properties like which items are selected. The other functionality comes from these classes over here. So the ListBox, every item that's added to the ListBox is actually wrapped in something called the ListBoxItem.…
Contents
-
-
-
-
-
-
-
What does content mean in XAML?6m 9s
-
(Locked)
TextBlock and InLine content1m 55s
-
(Locked)
Layout panels2m 11s
-
(Locked)
Complex content within a ContentControl4m 6s
-
(Locked)
Non-UI types in ContentControl1m 55s
-
(Locked)
Show lists of elements with ItemsControls2m 27s
-
(Locked)
Fill a list using Binding2m 41s
-
(Locked)
Make an item selectable with a ListBoxItem1m 57s
-
(Locked)
Wrap content with a decorator2m 11s
-
-
-
-
-
-
-
-