/// <summary> /// Calls the <see cref="OnAttachedToVisualTree(IRenderRoot)"/> method for this control /// and all of its visual descendents. /// </summary> /// <param name="root">The root of the visual tree.</param> private void NotifyAttachedToVisualTree(IRenderRoot root) { _visualLogger.Verbose("Attached to visual tree"); _isAttachedToVisualTree = true; OnAttachedToVisualTree(root); if (_visualChildren != null) { foreach (Visual child in _visualChildren.OfType <Visual>()) { child.NotifyAttachedToVisualTree(root); } } }
/// <summary> /// Calls the <see cref="OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)"/> method /// for this control and all of its visual descendents. /// </summary> /// <param name="e">The event args.</param> private void NotifyAttachedToVisualTree(VisualTreeAttachmentEventArgs e) { _visualLogger.Verbose("Attached to visual tree"); _isAttachedToVisualTree = true; if (Name != null && e.NameScope != null) { e.NameScope.Register(Name, this); } OnAttachedToVisualTree(e); if (_visualChildren != null) { foreach (Visual child in _visualChildren.OfType <Visual>()) { var ce = child.GetAttachmentEventArgs(e); child.NotifyAttachedToVisualTree(ce); } } }