Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / AttachedPropertyBrowsableForChildrenAttribute.cs / 1 / AttachedPropertyBrowsableForChildrenAttribute.cs
namespace System.Windows { using System; ////// This attribute declares that a property is visible when the /// property owner is a parent of another element. For example, /// Canvas.Left is only useful on elements parented within the /// canvas. The class supports two types of tree walks: a shallow /// walk, the default which requires that the immediate parent be the /// owner type of the property, and a deep walk, declared by setting /// IncludeDescendants to true and requires that the owner type be /// somewhere in the parenting hierarchy. /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public sealed class AttachedPropertyBrowsableForChildrenAttribute : AttachedPropertyBrowsableAttribute { //------------------------------------------------------ // // Constructors // //----------------------------------------------------- ////// Creates a new AttachedPropertyBrowsableForChildrenAttribute. /// public AttachedPropertyBrowsableForChildrenAttribute() { } //----------------------------------------------------- // // Public Properties // //----------------------------------------------------- ////// Gets or sets if the property should be browsable for just the /// immediate children (false) or all children (true). /// public bool IncludeDescendants { get { return _includeDescendants; } set { _includeDescendants = value; } } //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- ////// Overrides Object.Equals to implement correct equality semantics for this /// attribute. /// public override bool Equals(object obj) { AttachedPropertyBrowsableForChildrenAttribute other = obj as AttachedPropertyBrowsableForChildrenAttribute; if (other == null) return false; return _includeDescendants == other._includeDescendants; } ////// Overrides Object.GetHashCode to implement correct hashing semantics. /// public override int GetHashCode() { return _includeDescendants.GetHashCode(); } //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ ////// Returns true if the object provided is the immediate logical /// child (if IncludeDescendants is false) or any logical child /// (if IncludeDescendants is true). /// internal override bool IsBrowsable(DependencyObject d, DependencyProperty dp) { if (d == null) throw new ArgumentNullException("d"); if (dp == null) throw new ArgumentNullException("dp"); DependencyObject walk = d; Type ownerType = dp.OwnerType; do { walk = FrameworkElement.GetFrameworkParent(walk); if (walk != null && ownerType.IsInstanceOfType(walk)) { return true; } } while (_includeDescendants && walk != null); return false; } //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ private bool _includeDescendants; } } // 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
- Vector3DIndependentAnimationStorage.cs
- ExpandSegment.cs
- SystemException.cs
- HorizontalAlignConverter.cs
- SystemIPGlobalStatistics.cs
- TextureBrush.cs
- SQLInt64Storage.cs
- OptimalBreakSession.cs
- DataControlPagerLinkButton.cs
- IisTraceListener.cs
- COM2Enum.cs
- PrintEvent.cs
- DataGridViewEditingControlShowingEventArgs.cs
- GridSplitterAutomationPeer.cs
- UpdateRecord.cs
- FormatSettings.cs
- SpeakInfo.cs
- ContainerVisual.cs
- DataGridViewAdvancedBorderStyle.cs
- AspNetHostingPermission.cs
- UnsafeNativeMethods.cs
- _TimerThread.cs
- Speller.cs
- DropShadowBitmapEffect.cs
- ComponentSerializationService.cs
- XmlSchemaAnnotation.cs
- ZeroOpNode.cs
- SecUtil.cs
- HttpResponseBase.cs
- BaseCollection.cs
- OrderablePartitioner.cs
- sqlstateclientmanager.cs
- TableCellCollection.cs
- DesignTimeDataBinding.cs
- QilXmlReader.cs
- ConfigPathUtility.cs
- Roles.cs
- TextContainer.cs
- Timer.cs
- CreateWorkflowOwnerCommand.cs
- ListControlDesigner.cs
- MouseCaptureWithinProperty.cs
- DropShadowEffect.cs
- DeclarativeCatalogPart.cs
- RandomNumberGenerator.cs
- ViewGenResults.cs
- ServiceXNameTypeConverter.cs
- SmiContextFactory.cs
- AdapterUtil.cs
- EntityConnectionStringBuilder.cs
- SpellerStatusTable.cs
- _Win32.cs
- EDesignUtil.cs
- SchemaName.cs
- EndpointAddressProcessor.cs
- VisualProxy.cs
- _NtlmClient.cs
- ProfileService.cs
- FillRuleValidation.cs
- ApplicationInfo.cs
- RoutedEventValueSerializer.cs
- ExpressionParser.cs
- DependencyPropertyChangedEventArgs.cs
- NetMsmqSecurityMode.cs
- VoiceInfo.cs
- HtmlInputReset.cs
- GPRECT.cs
- AsyncPostBackTrigger.cs
- ParagraphResult.cs
- DataServiceConfiguration.cs
- Calendar.cs
- StartUpEventArgs.cs
- ComponentCodeDomSerializer.cs
- TextProperties.cs
- HttpDebugHandler.cs
- AnnotationMap.cs
- ContentType.cs
- TemplateKeyConverter.cs
- SafeCancelMibChangeNotify.cs
- DependencyPropertyKind.cs
- UIntPtr.cs
- Buffer.cs
- COM2ExtendedTypeConverter.cs
- TrackingLocationCollection.cs
- LabelAutomationPeer.cs
- ContextQuery.cs
- smtppermission.cs
- PolicyChain.cs
- CompilerGlobalScopeAttribute.cs
- Debug.cs
- ConfigXmlSignificantWhitespace.cs
- ReversePositionQuery.cs
- GlyphsSerializer.cs
- HtmlElementErrorEventArgs.cs
- DragDrop.cs
- WindowsListViewGroup.cs
- SHA512.cs
- PrimitiveType.cs
- DataGridBeginningEditEventArgs.cs
- FacetEnabledSchemaElement.cs