Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Visual.RemoveVisualChild Method

Removes the parent-child relationship between two visuals.

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

member RemoveVisualChild : 
        child:Visual -> unit

Parameters

child
Type: System.Windows.Media.Visual

The child visual object to remove from the parent visual.

The RemoveVisualChild method removes the parent-child relationship between two visuals. This method, along with the AddVisualChild method, must be used when you need greater low-level control over the underlying storage implementation of visual child objects. VisualCollection can be used as a default implementation for storing child objects.

The following example shows how to define custom storage requirements for a visual child. The example uses the AddVisualChild and RemoveVisualChild methods to sets up the parent-child relationship between the parent visual and child. In order for the visual tree to be enumerated correctly, the example provides overridden implementations of the GetVisualChild method and VisualChildrenCount property.

NoteNote

Although it is possible to use VisualCollection to create parent-child relationships between visual objects, it is more efficient to provide your own custom storage implementation when only one child is linked to a parent.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft