/// <summary> /// Updates the IsLoadedCache on the current FrameworkElement /// </summary> private static void UpdateIsLoadedCache( FrameworkElement fe, DependencyObject parent) { if (fe.GetValue(FrameworkElement.LoadedPendingProperty) == null) { // Propagate the change to your visual ancestry if (parent != null) { fe.IsLoadedCache = IsLoadedHelper(parent); } // This is the root visual. else if (SafeSecurityHelper.IsConnectedToPresentationSource(fe)) { fe.IsLoadedCache = true; } else { fe.IsLoadedCache = false; } } else { // Clear the cache if Loaded is pending fe.IsLoadedCache = false; } }
// Token: 0x06000319 RID: 793 RVA: 0x00008CA5 File Offset: 0x00006EA5 private static void UpdateIsLoadedCache(FrameworkElement fe, DependencyObject parent) { if (fe.GetValue(FrameworkElement.LoadedPendingProperty) != null) { fe.IsLoadedCache = false; return; } if (parent != null) { fe.IsLoadedCache = BroadcastEventHelper.IsLoadedHelper(parent); return; } if (SafeSecurityHelper.IsConnectedToPresentationSource(fe)) { fe.IsLoadedCache = true; return; } fe.IsLoadedCache = false; }
// Helper method that recursively queries the parents to see if they are loaded. // This method is invoked only when the loaded cache on the given node isn't valid. internal static bool IsParentLoaded(DependencyObject d) { FrameworkObject fo = new FrameworkObject(d); DependencyObject parent = fo.EffectiveParent; Visual visual; Visual3D visual3D; if (parent != null) { return(IsLoadedHelper(parent)); } else if ((visual = d as Visual) != null) { // If parent is null then this is the root element return(SafeSecurityHelper.IsConnectedToPresentationSource(visual)); } else if ((visual3D = d as Visual3D) != null) { // IsConnectedToPresentationSource could also be modified to take // a DO - instead though we'll just get the containing visual2D for // this 3D object. visual = VisualTreeHelper.GetContainingVisual2D(visual3D); if (visual != null) { return(SafeSecurityHelper.IsConnectedToPresentationSource(visual)); } else { return(false); } } else { return(false); } }
// Token: 0x06000312 RID: 786 RVA: 0x000089EC File Offset: 0x00006BEC internal static bool IsParentLoaded(DependencyObject d) { FrameworkObject frameworkObject = new FrameworkObject(d); DependencyObject effectiveParent = frameworkObject.EffectiveParent; if (effectiveParent != null) { return(BroadcastEventHelper.IsLoadedHelper(effectiveParent)); } Visual visual; if ((visual = (d as Visual)) != null) { return(SafeSecurityHelper.IsConnectedToPresentationSource(visual)); } Visual3D reference; if ((reference = (d as Visual3D)) != null) { visual = VisualTreeHelper.GetContainingVisual2D(reference); return(visual != null && SafeSecurityHelper.IsConnectedToPresentationSource(visual)); } return(false); }