Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / MS / Internal / DeferredElementTreeState.cs / 2 / DeferredElementTreeState.cs
using System.Windows; using System.Collections.Generic; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Media3D; namespace MS.Internal { internal class DeferredElementTreeState { public void SetCoreParent(DependencyObject element, DependencyObject parent) { if(!_oldCoreParents.ContainsKey(element)) { _oldCoreParents[element] = parent; } } public static DependencyObject GetCoreParent(DependencyObject element, DeferredElementTreeState treeState) { DependencyObject parent = null; if(treeState != null && treeState._oldCoreParents.ContainsKey(element)) { parent = treeState._oldCoreParents[element]; } else { Visual v = element as Visual; if(v != null) { parent = VisualTreeHelper.GetParent(v); } else { ContentElement ce = element as ContentElement; if(ce != null) { parent = ContentOperations.GetParent(ce); } else { Visual3D v3D = element as Visual3D; if (v3D != null) { parent = VisualTreeHelper.GetParent(v3D); } } } } return parent; } public static DependencyObject GetInputElementParent(DependencyObject element, DeferredElementTreeState treeState) { DependencyObject parent = element; while (true) { parent = GetCoreParent(parent, treeState); if (parent == null || InputElement.IsValid(parent)) { break; } } return parent; } public void SetLogicalParent(DependencyObject element, DependencyObject parent) { if(!_oldLogicalParents.ContainsKey(element)) { _oldLogicalParents[element] = parent; } } public static DependencyObject GetLogicalParent(DependencyObject element, DeferredElementTreeState treeState) { DependencyObject parent = null; if(treeState != null && treeState._oldLogicalParents.ContainsKey(element)) { parent = treeState._oldLogicalParents[element]; } else { UIElement e = element as UIElement; if(e != null) { parent = e.GetUIParentCore(); // Overriden by FrameworkElement. } ContentElement ce = element as ContentElement; if(ce != null) { parent = ce.GetUIParentCore(); // Overriden by FrameworkContentElement. } } return parent; } public void Clear() { _oldCoreParents.Clear(); _oldLogicalParents.Clear(); } public bool IsEmpty { get { return _oldCoreParents.Count > 0 || _oldLogicalParents.Count > 0; } } private Dictionary_oldCoreParents = new Dictionary (); private Dictionary _oldLogicalParents = new Dictionary (); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RequestCacheManager.cs
- CellRelation.cs
- XmlSchemaIdentityConstraint.cs
- BrushValueSerializer.cs
- ListViewContainer.cs
- KnownTypeAttribute.cs
- UnsafeNativeMethods.cs
- ColumnResizeUndoUnit.cs
- CompiledQuery.cs
- odbcmetadatacolumnnames.cs
- SoapParser.cs
- WinOEToolBoxItem.cs
- SQLMoneyStorage.cs
- FormattedTextSymbols.cs
- ColorPalette.cs
- ConstraintManager.cs
- ToolboxItemFilterAttribute.cs
- InstanceHandleReference.cs
- HtmlHead.cs
- RangeValidator.cs
- Application.cs
- SoapDocumentServiceAttribute.cs
- AuthorizationPolicyTypeElement.cs
- BindingMemberInfo.cs
- DataObjectEventArgs.cs
- securestring.cs
- MarshalByValueComponent.cs
- MessageEventSubscriptionService.cs
- FontStretch.cs
- RijndaelManaged.cs
- TargetControlTypeAttribute.cs
- VectorAnimationUsingKeyFrames.cs
- ResolveDuplexAsyncResult.cs
- SelectionChangedEventArgs.cs
- CompressionTransform.cs
- Win32Interop.cs
- ResXDataNode.cs
- ModuleConfigurationInfo.cs
- TemplatedAdorner.cs
- StorageMappingItemCollection.cs
- DesignerSerializationVisibilityAttribute.cs
- DomainUpDown.cs
- PieceNameHelper.cs
- QilScopedVisitor.cs
- SqlFlattener.cs
- SqlTriggerContext.cs
- StylusButtonEventArgs.cs
- SettingsProviderCollection.cs
- XmlElementAttribute.cs
- AssertSection.cs
- SecUtil.cs
- DecoderReplacementFallback.cs
- XmlAttributeProperties.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- Button.cs
- FixedSOMTextRun.cs
- RemoteWebConfigurationHost.cs
- path.cs
- ReadContentAsBinaryHelper.cs
- ControlCachePolicy.cs
- StorageInfo.cs
- ActivityExecutorSurrogate.cs
- FeatureSupport.cs
- FileDetails.cs
- PerformanceCounters.cs
- WindowProviderWrapper.cs
- GridViewSelectEventArgs.cs
- DefaultShape.cs
- ChangeDirector.cs
- Model3DGroup.cs
- RequiredArgumentAttribute.cs
- UIHelper.cs
- PrtCap_Public_Simple.cs
- BaseParaClient.cs
- TextRangeAdaptor.cs
- PngBitmapEncoder.cs
- DataTable.cs
- EpmAttributeNameBuilder.cs
- ListView.cs
- WorkflowRuntimeServicesBehavior.cs
- BindingExpressionUncommonField.cs
- CopyNamespacesAction.cs
- RemotingHelper.cs
- AsyncPostBackTrigger.cs
- WebFormsRootDesigner.cs
- ADMembershipProvider.cs
- ChangePassword.cs
- TypeGenericEnumerableViewSchema.cs
- GridViewSelectEventArgs.cs
- DataGridViewToolTip.cs
- MediaTimeline.cs
- ConnectionPointGlyph.cs
- CultureSpecificCharacterBufferRange.cs
- ItemCheckedEvent.cs
- CapabilitiesSection.cs
- _WinHttpWebProxyDataBuilder.cs
- DataError.cs
- IIS7ConfigurationLoader.cs
- SQLGuid.cs
- RegexStringValidator.cs