CompositionContainer.Compose Method (CompositionBatch)

 

Adds or removes the parts in the specified CompositionBatch from the container and executes composition.

Namespace:   System.ComponentModel.Composition.Hosting
Assembly:  System.ComponentModel.Composition (in System.ComponentModel.Composition.dll)

member Compose : 
        batch:CompositionBatch -> unit

Parameters

batch
Type: System.ComponentModel.Composition.Hosting.CompositionBatch

Changes to the CompositionContainer to include during the composition.

This method is the primary way of directly adding or removing parts from the container. The CompositionContainer will always maintain a stable, composed state. Therefore, calling Compose with an empty CompositionBatch is never necessary to start composition. Instead, call the Compose method whenever you need to make changes to the parts available to the CompositionContainer.

The CompositionBatch can contain both parts to be added and parts to be removed. Recomposition will take place only once for each call to Compose.

In this simple example, three parts are created and added to the CompositionContainer, and one part is retrieved to show that all imports have been filled. This example uses the Attributed Programming Model.

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

.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Return to top
Show: