/// <summary> /// The colleciton is the children collection of the visualParent. The logicalParent /// is used to do logical parenting. The flags is used to invalidate /// the resource properties in the child tree, if an Application object exists. /// </summary> /// <param name="visualParent">The element of whom this is a children collection</param> /// <param name="logicalParent">The logicalParent of the elements of this collection. /// if overriding Panel.CreateUIElementCollection, pass the logicalParent parameter of that method here. /// </param> public UIElementCollection(UIElement visualParent, FrameworkElement logicalParent) { if (visualParent == null) { throw new ArgumentNullException(SR.Get(SRID.Panel_NoNullVisualParent, "visualParent", this.GetType())); } _visualChildren = new VisualCollection(visualParent); _visualParent = visualParent; _logicalParent = logicalParent; }
public MyVisualHost() { _children = new System.Windows.Media.VisualCollection(this) { CreateDrawingVisualAA(), //CreateDrawingImage(), //CreateDrawingVisualRectangle(), //CreateDrawingVisualText(), //CreateDrawingVisualEllipses() }; // Add the event handler for MouseLeftButtonUp. MouseLeftButtonUp += MyVisualHost_MouseLeftButtonUp; }
// Initialize the ResizingAdorner. public ResizingAdorner(System.Windows.UIElement adornedElement) : base(adornedElement) { visualChildren = new VisualCollection(this); // Call a helper method to initialize the Thumbs // with a customized cursors. BuildAdornerCorner(ref topLeft, Cursors.SizeNWSE); BuildAdornerCorner(ref topRight, Cursors.SizeNESW); BuildAdornerCorner(ref bottomLeft, Cursors.SizeNESW); BuildAdornerCorner(ref bottomRight, Cursors.SizeNWSE); // Add handlers for resizing. bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft); bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight); topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft); topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight); }
internal Enumerator(VisualCollection collection) { _collection = collection; _index = -1; // not started. _version = _collection.Version; _currentElement = null; }
/// <summary> /// Ctor ContainerVisual. /// </summary> public ContainerVisual() { _children = new VisualCollection(this); }
//--------------------------------------------------------------- // Ctor //--------------------------------------------------------------- internal ComplexContent(TextBlock owner, ITextContainer textContainer, bool foreignTextContianer, string content) { // Paramaters validation Debug.Assert(owner != null); Debug.Assert(textContainer != null); VisualChildren = new VisualCollection(owner); // Store TextContainer that contains content of the element. TextContainer = textContainer; ForeignTextContainer = foreignTextContianer; // Add content if (content != null && content.Length > 0) { TextBlock.InsertTextRun(this.TextContainer.End, content, /*whitespacesIgnorable:*/false); } // Create TextView associated with TextContainer. this.TextView = new TextParagraphView(owner, TextContainer); // Hookup TextContainer to TextView. this.TextContainer.TextView = this.TextView; }
public RectDrawingVisual() { Visuals = new System.Windows.Media.VisualCollection(this); }
/// <summary> /// Constructor /// </summary> /// <param name="context">Dispatcher</param> /// <remarks> /// Note that because we're setting up an event handler here, we won't be GC'd until /// our parent is GC'd. So the implicit assumption is that the AdornerLayer, once /// created, exists until its parent is deleted. /// </remarks> internal AdornerLayer(Dispatcher context) { if (context == null) throw new ArgumentNullException("context"); LayoutUpdated += new EventHandler(OnLayoutUpdated); _children = new VisualCollection(this); }