O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Items in the Control

ItemsControl stores its content in an Items property (of type ItemCollection). Each item can be an arbitrary object (System.Object) that by default gets rendered just as it would inside a content control. In other words, any UIElement is rendered as expected, and (ignoring data templates) any other type is rendered as a TextBlock containing the string returned by its ToString method.

The simple ListBox control shown in Chapter 2, “Child Elements and Keywords,” is an items control. Whereas Chapter 2 always adds ListBoxItems to the Items collection, the following example adds arbitrary objects to Items instead:

<ListBox xmlns:sys="using:System">  <Button>Button</Button>  <x:Double>1.23</x:Double ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required