This documentation is archived and is not being maintained.
VisualCollection Class
Visual Studio 2008
Represents an ordered collection of Visual objects.
Assembly: PresentationCore (in PresentationCore.dll)
A VisualCollection has implied context affinity. If a procedure attempts to access the VisualCollection from a different context than the context of the owning ContainerVisual, an exception is thrown.
The following example shows how to create a VisualCollection and add members to it.
// Create a host visual derived from the FrameworkElement class. // This class provides layout, event handling, and container support for // the child visual objects. public class MyVisualHost : FrameworkElement { // Create a collection of child visual objects. private VisualCollection _children; public MyVisualHost() { _children = new VisualCollection(this); _children.Add(CreateDrawingVisualRectangle()); _children.Add(CreateDrawingVisualText()); _children.Add(CreateDrawingVisualEllipses()); // Add the event handler for MouseLeftButtonUp. this.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(MyVisualHost_MouseLeftButtonUp); }
Note: |
|---|
For the complete sample, see Hit Test Using DrawingVisuals Sample. |
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show:
Note: