/// <summary>
        ///     Broadcast the Loaded/Unloaded event in the sub-tree starting at the given root
        /// </summary>
        /// <param name="root">
        ///     Root of the sub-tree that the event will be broadcast to
        /// </param>
        /// <param name="routedEvent">
        ///     RoutedEventID for the event we wish to broadcast
        /// </param>
        private static void BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
        {
            // Broadcast to the tree and collect the set of nodes
            // on which we need fire the Loaded event
            List <DependencyObject> eventRoute = new List <DependencyObject>();

            // Create a DescendentsWalker for the broadcast
            DescendentsWalker <BroadcastEventData> walker = new DescendentsWalker <BroadcastEventData>(
                TreeWalkPriority.VisualTree, BroadcastDelegate, new BroadcastEventData(root, routedEvent, eventRoute));

            // Start the walk down
            walker.StartWalk(root);

            // Iterate and raise the event on each of the nodes in the tree
            for (int i = 0; i < eventRoute.Count; i++)
            {
                DependencyObject d    = eventRoute[i];
                RoutedEventArgs  args = new RoutedEventArgs(routedEvent, d);
                FrameworkObject  fo   = new FrameworkObject(d, true /*throwIfNeither*/);

                if (routedEvent == FrameworkElement.LoadedEvent)
                {
                    fo.OnLoaded(args);
                }
                else
                {
                    fo.OnUnloaded(args);
                }
            }
        }
        // Token: 0x0600030C RID: 780 RVA: 0x00008740 File Offset: 0x00006940
        private static void BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
        {
            List <DependencyObject> list = new List <DependencyObject>();
            DescendentsWalker <BroadcastEventHelper.BroadcastEventData> descendentsWalker = new DescendentsWalker <BroadcastEventHelper.BroadcastEventData>(TreeWalkPriority.VisualTree, BroadcastEventHelper.BroadcastDelegate, new BroadcastEventHelper.BroadcastEventData(root, routedEvent, list));

            descendentsWalker.StartWalk(root);
            for (int i = 0; i < list.Count; i++)
            {
                DependencyObject dependencyObject = list[i];
                RoutedEventArgs  args             = new RoutedEventArgs(routedEvent, dependencyObject);
                FrameworkObject  frameworkObject  = new FrameworkObject(dependencyObject, true);
                if (routedEvent == FrameworkElement.LoadedEvent)
                {
                    frameworkObject.OnLoaded(args);
                }
                else
                {
                    frameworkObject.OnUnloaded(args);
                }
            }
        }