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

Embedding UIElements

The fact that RichTextBlock can contain embedded UIElements is not obvious from looking at its APIs. This capability comes from the InlineUIContainer element, which is an Inline. It has a simple Child content property of type UIElement.

Although InlineUIContainer should be able to be added to the plain old TextBlock’s Inlines collection, doing so fails at runtime. It turns out that InlineUIContainers must be placed within a Block, and this is the reason that this feature is supported only by RichTextBlock.

The capability to embed a UIElement among text means you can insert just about anything: an image, a video, a Panel containing a large tree of elements, and so on. Such elements are fully interactive and can get focus, ...

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