FrameworkContentElement.AddLogicalChild(Object) Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Adds the provided element as a child of this element.

C#
protected internal void AddLogicalChild(object child);

Parameters

child
Object

The child element to be added.

Remarks

This method can throw an exception if called at a time when the logical tree is being iterated by another process.

Most FrameworkContentElement derived classes expose dedicated collections that are responsible for containment (for example, Inlines on the Span class; Blocks on the Section class). You can typically avoid any need to manipulate the logical tree directly if you derive from these classes instead. Working with the logical tree for content elements is an advanced scenario that may require a specialized parser or a specialized FrameworkElement that acts as the parent rendering element (content host).

For more information about how to use LogicalChildren and AddLogicalChild, see Trees in WPF.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also