Files
docs-desktop/dotnet-desktop-guide/framework/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-inlines-property.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

4.4 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Manipulate Flow Content Elements through the Inlines Property 03/30/2017
csharp
vb
flow content elements [WPF], manipulating through Inlines property
documents [WPF], manipulating flow Content elements through Inlines property
Inlines property [WPF], manipulating flow Content elements
properties [WPF], Inlines [WPF], manipulating flow Content elements
510780d2-3da1-4360-8763-7054bda22ea3

How to: Manipulate Flow Content Elements through the Inlines Property

These examples demonstrate some of the more common operations that can be performed on inline flow content elements (and containers of such elements, such as xref:System.Windows.Controls.TextBlock) through the Inlines property. This property is used to add and remove items from xref:System.Windows.Documents.InlineCollection. Flow content elements that feature an Inlines property include:

These examples happen to use xref:System.Windows.Documents.Span as the flow content element, but these techniques are applicable to all elements or controls that host an xref:System.Windows.Documents.InlineCollection collection.

Example

The following example creates a new xref:System.Windows.Documents.Span object, and then uses the Add method to add two text runs as content children of the xref:System.Windows.Documents.Span.

[!code-csharpSpanSnippets#_SpanInlinesAdd] [!code-vbSpanSnippets#_SpanInlinesAdd]

Example

The following example creates a new xref:System.Windows.Documents.Run element and inserts it at the beginning of the xref:System.Windows.Documents.Span.

[!code-csharpSpanSnippets#_SpanInlinesInsert] [!code-vbSpanSnippets#_SpanInlinesInsert]

Example

The following example gets the number of top-level xref:System.Windows.Documents.Inline elements contained in the xref:System.Windows.Documents.Span.

[!code-csharpSpanSnippets#_SpanInlinesCount] [!code-vbSpanSnippets#_SpanInlinesCount]

Example

The following example deletes the last xref:System.Windows.Documents.Inline element in the xref:System.Windows.Documents.Span.

[!code-csharpSpanSnippets#_SpanInlinesRemoveLast] [!code-vbSpanSnippets#_SpanInlinesRemoveLast]

Example

The following example clears all of the contents (xref:System.Windows.Documents.Inline elements) from the xref:System.Windows.Documents.Span.

[!code-csharpSpanSnippets#_SpanInlinesClear] [!code-vbSpanSnippets#_SpanInlinesClear]

See also