Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / 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. 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FileDetails.cs
- InsufficientMemoryException.cs
- CompiledAction.cs
- TracePayload.cs
- CurrencyManager.cs
- AxHost.cs
- ParenExpr.cs
- ThreadInterruptedException.cs
- UnsignedPublishLicense.cs
- AesCryptoServiceProvider.cs
- NavigationWindowAutomationPeer.cs
- ContextMenuAutomationPeer.cs
- HashHelper.cs
- FontNamesConverter.cs
- X509Utils.cs
- SettingsPropertyIsReadOnlyException.cs
- ToolStripCollectionEditor.cs
- SamlAction.cs
- DataGridViewCellValidatingEventArgs.cs
- TypefaceCollection.cs
- IPEndPoint.cs
- MDIClient.cs
- hresults.cs
- OpenTypeLayoutCache.cs
- DetailsViewModeEventArgs.cs
- HuffmanTree.cs
- IPPacketInformation.cs
- XmlC14NWriter.cs
- SafeNativeMethodsOther.cs
- GZipObjectSerializer.cs
- StylusPoint.cs
- LayoutManager.cs
- AmbientLight.cs
- ArcSegment.cs
- GeneralTransform3DGroup.cs
- SystemNetworkInterface.cs
- CodeCompileUnit.cs
- WinInetCache.cs
- OutOfProcStateClientManager.cs
- DesignTimeTemplateParser.cs
- FullTextLine.cs
- HtmlElementEventArgs.cs
- NavigationPropertySingletonExpression.cs
- NativeObjectSecurity.cs
- TableRowGroup.cs
- ControlAdapter.cs
- XslNumber.cs
- TraceListener.cs
- ValueTypeFixupInfo.cs
- Connector.xaml.cs
- LOSFormatter.cs
- TreeIterator.cs
- ConnectionConsumerAttribute.cs
- FontDifferentiator.cs
- CellTreeNodeVisitors.cs
- MtomMessageEncoder.cs
- HandledMouseEvent.cs
- UnmanagedMarshal.cs
- StylusPointPropertyInfo.cs
- IArgumentProvider.cs
- ObjectQuery.cs
- SafeIUnknown.cs
- CustomPopupPlacement.cs
- XmlCountingReader.cs
- WhitespaceRuleReader.cs
- XmlDataLoader.cs
- Span.cs
- NetMsmqSecurityMode.cs
- webeventbuffer.cs
- _DisconnectOverlappedAsyncResult.cs
- XmlWellformedWriter.cs
- ExpressionBinding.cs
- MenuCommands.cs
- CompositionTarget.cs
- DataGridTable.cs
- ScrollData.cs
- SQLInt16.cs
- Application.cs
- Substitution.cs
- SamlConditions.cs
- PageBuildProvider.cs
- CompiledRegexRunnerFactory.cs
- NumericUpDownAccelerationCollection.cs
- GorillaCodec.cs
- PrimitiveSchema.cs
- ResourceDescriptionAttribute.cs
- StateRuntime.cs
- MsmqReceiveHelper.cs
- RotationValidation.cs
- FamilyCollection.cs
- WaitHandle.cs
- AutoGeneratedFieldProperties.cs
- ProxyWebPartManagerDesigner.cs
- Visual3D.cs
- ListViewItem.cs
- WindowsGraphics2.cs
- OleDbException.cs
- PersonalizationState.cs
- safelinkcollection.cs
- StringArrayConverter.cs