Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / DescendentsWalkerBase.cs / 1305600 / 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; } /// /// 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
- ConsumerConnectionPoint.cs
- SystemIPGlobalProperties.cs
- TemplatePropertyEntry.cs
- DescendantQuery.cs
- StringValueSerializer.cs
- CodeIndexerExpression.cs
- CollectionMarkupSerializer.cs
- XmlILAnnotation.cs
- PenCursorManager.cs
- QuaternionKeyFrameCollection.cs
- TextBreakpoint.cs
- XmlIgnoreAttribute.cs
- _SSPISessionCache.cs
- OleDbRowUpdatingEvent.cs
- ConnectionPointCookie.cs
- Soap.cs
- ThreadInterruptedException.cs
- TreeViewEvent.cs
- RTTypeWrapper.cs
- SemanticResultValue.cs
- RegexNode.cs
- WebPartTransformerCollection.cs
- InputLanguageProfileNotifySink.cs
- ProgressBar.cs
- ReadOnlyTernaryTree.cs
- ColorContextHelper.cs
- PageSettings.cs
- RootDesignerSerializerAttribute.cs
- LostFocusEventManager.cs
- Int64Converter.cs
- CompilerGeneratedAttribute.cs
- TemplateContentLoader.cs
- SortableBindingList.cs
- HwndSourceParameters.cs
- ExportException.cs
- EntityParameterCollection.cs
- WpfWebRequestHelper.cs
- ReadOnlyMetadataCollection.cs
- NameSpaceEvent.cs
- CopyNamespacesAction.cs
- LiteralControl.cs
- ProviderCommandInfoUtils.cs
- DrawItemEvent.cs
- HMACSHA1.cs
- ReadWriteControlDesigner.cs
- JournalNavigationScope.cs
- ObjectQueryState.cs
- columnmapkeybuilder.cs
- Hex.cs
- EncryptedData.cs
- ReadOnlyState.cs
- RightsManagementEncryptionTransform.cs
- SqlDataReader.cs
- TaiwanCalendar.cs
- Console.cs
- RectAnimation.cs
- EncoderFallback.cs
- RadioButton.cs
- StandardMenuStripVerb.cs
- ListViewGroupCollectionEditor.cs
- ContextDataSourceView.cs
- CompoundFileStreamReference.cs
- GeneratedContractType.cs
- XmlHelper.cs
- PersonalizablePropertyEntry.cs
- ZipIOExtraField.cs
- ping.cs
- LinqDataSourceView.cs
- ToolboxItemAttribute.cs
- RbTree.cs
- SystemUdpStatistics.cs
- ServerIdentity.cs
- codemethodreferenceexpression.cs
- MatrixTransform3D.cs
- WinCategoryAttribute.cs
- OdbcEnvironment.cs
- mediaeventshelper.cs
- LongTypeConverter.cs
- Merger.cs
- IncrementalCompileAnalyzer.cs
- Baml6Assembly.cs
- Types.cs
- WindowsStatic.cs
- Win32.cs
- NamespaceTable.cs
- BorderGapMaskConverter.cs
- SettingsSection.cs
- ObjectFullSpanRewriter.cs
- AvTraceFormat.cs
- DropShadowBitmapEffect.cs
- SessionPageStateSection.cs
- LazyLoadBehavior.cs
- MultiBinding.cs
- CacheOutputQuery.cs
- ObjectDataSourceMethodEventArgs.cs
- TypeLibConverter.cs
- AssemblyAttributesGoHere.cs
- DbParameterCollectionHelper.cs
- PointAnimationUsingKeyFrames.cs
- CompilerInfo.cs