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
- Page.cs
- Byte.cs
- UnmanagedHandle.cs
- DbDeleteCommandTree.cs
- NativeMethods.cs
- RequestUriProcessor.cs
- GridView.cs
- FontInfo.cs
- SafeBitVector32.cs
- SystemUnicastIPAddressInformation.cs
- ValidatorCollection.cs
- exports.cs
- TableRowCollection.cs
- ObjectConverter.cs
- XamlClipboardData.cs
- Html32TextWriter.cs
- Endpoint.cs
- SoapSchemaExporter.cs
- HandleRef.cs
- ScriptBehaviorDescriptor.cs
- FontFamilyConverter.cs
- XmlDocumentSurrogate.cs
- EntityDescriptor.cs
- Zone.cs
- DiagnosticsConfiguration.cs
- NativeCppClassAttribute.cs
- InkCanvasSelection.cs
- LogPolicy.cs
- ObjectListShowCommandsEventArgs.cs
- DataGridViewCellParsingEventArgs.cs
- SqlAliaser.cs
- HttpResponseInternalWrapper.cs
- Exception.cs
- ResourceDictionaryCollection.cs
- StringAttributeCollection.cs
- ResourcePermissionBaseEntry.cs
- SerializerDescriptor.cs
- SerialStream.cs
- MatrixIndependentAnimationStorage.cs
- PolicyLevel.cs
- DbProviderFactories.cs
- LoadedOrUnloadedOperation.cs
- PackWebRequest.cs
- TabControlEvent.cs
- AsymmetricSignatureDeformatter.cs
- MimeFormImporter.cs
- Win32KeyboardDevice.cs
- TdsParserHelperClasses.cs
- RoleManagerModule.cs
- TextEndOfParagraph.cs
- SelectingProviderEventArgs.cs
- ConversionContext.cs
- TemplateControlCodeDomTreeGenerator.cs
- ResourcesGenerator.cs
- MethodBuilder.cs
- MemberCollection.cs
- CalendarDataBindingHandler.cs
- TrackBar.cs
- AttributeAction.cs
- NativeMethods.cs
- ComponentResourceKey.cs
- GeneralTransform3DCollection.cs
- SqlSelectStatement.cs
- LinkedList.cs
- DesignerForm.cs
- UnsafeNativeMethodsCLR.cs
- RuntimeConfigLKG.cs
- ImageCodecInfoPrivate.cs
- ThemeDirectoryCompiler.cs
- Form.cs
- DataSourceCache.cs
- CheckBoxDesigner.cs
- GridViewSelectEventArgs.cs
- DiscoveryDocumentSearchPattern.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- IIS7UserPrincipal.cs
- InputBinder.cs
- Nodes.cs
- CommandExpr.cs
- ContentElement.cs
- CryptoStream.cs
- WsdlBuildProvider.cs
- BitmapCodecInfoInternal.cs
- ConnectionInterfaceCollection.cs
- TaskFileService.cs
- ThreadAttributes.cs
- TagPrefixAttribute.cs
- SQLMoney.cs
- CodeBlockBuilder.cs
- ComponentConverter.cs
- GeneralTransformGroup.cs
- MarginsConverter.cs
- RenderData.cs
- FieldNameLookup.cs
- PrinterSettings.cs
- HttpListenerElement.cs
- ReliableSessionBindingElement.cs
- CodeDefaultValueExpression.cs
- Rect.cs
- NamedPipeHostedTransportConfiguration.cs