Microsoft.Practices.Prism.Regions.Behaviors.RegionActiveAwareBehavior.InvokeOnSynchronizedActiveAwareChildren C# (CSharp) Method

InvokeOnSynchronizedActiveAwareChildren() private method

private InvokeOnSynchronizedActiveAwareChildren ( object item, Action invocation ) : void
item object
invocation Action
return void
        private void InvokeOnSynchronizedActiveAwareChildren(object item, Action<IActiveAware> invocation)
        {
            var dependencyObjectView = item as DependencyObject;

            if (dependencyObjectView != null)
            {
                // We are assuming that any scoped region managers are attached directly to the 
                // view.
                var regionManager = RegionManager.GetRegionManager(dependencyObjectView);

                // If the view's RegionManager attached property is different from the region's RegionManager,
                // then the view's region manager is a scoped region manager.
                if (regionManager == null || regionManager == this.Region.RegionManager) return;

                var activeViews = regionManager.Regions.SelectMany(e => e.ActiveViews);

                var syncActiveViews = activeViews.Where(ShouldSyncActiveState);

                foreach (var syncActiveView in syncActiveViews)
                {
                    InvokeOnActiveAwareElement(syncActiveView, invocation);
                }
            }
        }