Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / DescendentsWalkerBase.cs / 2 / DescendentsWalkerBase.cs
using System; using System.Collections; using System.Diagnostics; using System.Windows; using System.Windows.Media; using MS.Utility; namespace System.Windows { ////// This is a base class to the DescendentsWalker. It is factored out so that /// FrameworkContextData can store and retrieve it from context local storage /// in a type agnostic manner. /// internal class DescendentsWalkerBase { #region Construction protected DescendentsWalkerBase(TreeWalkPriority priority) { _startNode = null; _priority = priority; _recursionDepth = 0; _nodes = new FrugalStructList(); } #endregion Construction internal bool WasVisited(DependencyObject d) { DependencyObject ancestor = d; while ((ancestor != _startNode) && (ancestor != null)) { DependencyObject logicalParent; if (FrameworkElement.DType.IsInstanceOfType(ancestor)) { FrameworkElement fe = ancestor as FrameworkElement; logicalParent = fe.Parent; // FrameworkElement DependencyObject dependencyObjectParent = VisualTreeHelper.GetParent(fe); if (dependencyObjectParent != null && logicalParent != null && dependencyObjectParent != logicalParent) { return _nodes.Contains(ancestor); } // Follow visual tree if not null otherwise we follow logical tree if (dependencyObjectParent != null) { ancestor = dependencyObjectParent; continue; } } else { // FrameworkContentElement FrameworkContentElement ancestorFCE = ancestor as FrameworkContentElement; logicalParent = (ancestorFCE != null) ? ancestorFCE.Parent : null; } ancestor = logicalParent; } return (ancestor != null); } internal DependencyObject _startNode; internal TreeWalkPriority _priority; internal FrugalStructList _nodes; internal int _recursionDepth; internal const int MAX_TREE_DEPTH = 250; } /// /// Enum specifying whether visual tree needs /// to be travesed first or the logical tree /// internal enum TreeWalkPriority { ////// Traverse Logical Tree first /// LogicalTree, ////// Traverse Visual Tree first /// VisualTree } } // 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
- LoadRetryConstantStrategy.cs
- XMLSchema.cs
- SettingsSavedEventArgs.cs
- XsdDuration.cs
- SHA512.cs
- ExpandCollapsePatternIdentifiers.cs
- FieldTemplateUserControl.cs
- ComplusEndpointConfigContainer.cs
- XmlDocumentSurrogate.cs
- CalloutQueueItem.cs
- ProtocolElementCollection.cs
- DataGridViewTextBoxColumn.cs
- CommandLineParser.cs
- DirectionalLight.cs
- ConstrainedDataObject.cs
- MasterPageCodeDomTreeGenerator.cs
- Ticks.cs
- StyleCollection.cs
- ConfigurationCollectionAttribute.cs
- DispatchChannelSink.cs
- JournalEntry.cs
- ElapsedEventArgs.cs
- ResetableIterator.cs
- SingleAnimationUsingKeyFrames.cs
- ComNativeDescriptor.cs
- HtmlElementCollection.cs
- UserPreferenceChangingEventArgs.cs
- XmlILCommand.cs
- SiteMapSection.cs
- safex509handles.cs
- __TransparentProxy.cs
- AnnotationAdorner.cs
- SystemMulticastIPAddressInformation.cs
- HttpApplication.cs
- DesignRelation.cs
- StringComparer.cs
- DiffuseMaterial.cs
- MethodBuilder.cs
- RecognizerStateChangedEventArgs.cs
- DataControlPagerLinkButton.cs
- NotifyIcon.cs
- DataColumnCollection.cs
- MetadataPropertyCollection.cs
- DataBindingExpressionBuilder.cs
- RIPEMD160.cs
- SystemInfo.cs
- Evidence.cs
- HttpNamespaceReservationInstallComponent.cs
- PropertyTab.cs
- ByteAnimation.cs
- Compiler.cs
- GridView.cs
- WebPartsPersonalizationAuthorization.cs
- _AutoWebProxyScriptEngine.cs
- WeakReference.cs
- TemplateEditingVerb.cs
- RegexStringValidatorAttribute.cs
- IdleTimeoutMonitor.cs
- SourceFileInfo.cs
- ExpressionWriter.cs
- StateMachine.cs
- ParagraphResult.cs
- ModuleBuilderData.cs
- XmlSchemaSimpleContentRestriction.cs
- ComplexPropertyEntry.cs
- FileLoadException.cs
- DummyDataSource.cs
- AttachedPropertyInfo.cs
- ContextInformation.cs
- CodeIterationStatement.cs
- SequentialUshortCollection.cs
- DragEvent.cs
- Attributes.cs
- SimpleType.cs
- CapabilitiesUse.cs
- InheritanceContextChangedEventManager.cs
- indexingfiltermarshaler.cs
- ColumnResizeAdorner.cs
- SqlException.cs
- ImmutablePropertyDescriptorGridEntry.cs
- DataGridViewIntLinkedList.cs
- XmlNodeChangedEventManager.cs
- ProfileEventArgs.cs
- PassportAuthenticationModule.cs
- EntityCollection.cs
- TypeBuilder.cs
- CrossAppDomainChannel.cs
- counter.cs
- SqlDataSourceView.cs
- UnmanagedHandle.cs
- SourceFileBuildProvider.cs
- ReceiveReply.cs
- TypeDescriptionProvider.cs
- EventLogTraceListener.cs
- ValueHandle.cs
- ThreadInterruptedException.cs
- GetPageCompletedEventArgs.cs
- DecimalConverter.cs
- DetailsView.cs
- EDesignUtil.cs