VisualCollection Class
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
'Declaration Public NotInheritable Class VisualCollection Implements ICollection, IEnumerable 'Usage Dim instance As VisualCollection
public final class VisualCollection implements ICollection, IEnumerable
public final class VisualCollection implements ICollection, IEnumerable
You cannot use this managed class in XAML.
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 will be 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 Using DrawingVisuals Sample. |
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: