Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / System / Windows / AttachedPropertyBrowsableWhenAttributePresentAttribute.cs / 1 / AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
namespace System.Windows { using System; using System.ComponentModel; ////// This attribute declares that an attached property can only be attached /// to an object that defines the given attribute on its class. /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public sealed class AttachedPropertyBrowsableWhenAttributePresentAttribute : AttachedPropertyBrowsableAttribute { //------------------------------------------------------ // // Constructors // //----------------------------------------------------- ////// Creates a new AttachedPropertyBrowsableWhenAttributePresentAttribute. Provide /// the type of attribute that, when present on a dependency object, /// should make the property browsable. /// public AttachedPropertyBrowsableWhenAttributePresentAttribute(Type attributeType) { if (attributeType == null) throw new ArgumentNullException("attributeType"); _attributeType = attributeType; } //----------------------------------------------------- // // Public Properties // //----------------------------------------------------- ////// Returns the attribute type passed into the constructor. /// public Type AttributeType { get { return _attributeType; } } //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- ////// Overrides Object.Equals to implement correct equality semantics for this /// attribute. /// public override bool Equals(object obj) { AttachedPropertyBrowsableWhenAttributePresentAttribute other = obj as AttachedPropertyBrowsableWhenAttributePresentAttribute; if (other == null) return false; return _attributeType == other._attributeType; } ////// Overrides Object.GetHashCode to implement correct hashing semantics. /// public override int GetHashCode() { return _attributeType.GetHashCode(); } //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ ////// Returns true if the dependency object class defines an attribute /// of the same type contained in this attribute. The attribute must /// differ from the "default" state of the attribute. /// internal override bool IsBrowsable(DependencyObject d, DependencyProperty dp) { if (d == null) throw new ArgumentNullException("d"); if (dp == null) throw new ArgumentNullException("dp"); Attribute a = TypeDescriptor.GetAttributes(d)[_attributeType]; return (a != null && !a.IsDefaultAttribute()); } //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ private Type _attributeType; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Windows { using System; using System.ComponentModel; ////// This attribute declares that an attached property can only be attached /// to an object that defines the given attribute on its class. /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public sealed class AttachedPropertyBrowsableWhenAttributePresentAttribute : AttachedPropertyBrowsableAttribute { //------------------------------------------------------ // // Constructors // //----------------------------------------------------- ////// Creates a new AttachedPropertyBrowsableWhenAttributePresentAttribute. Provide /// the type of attribute that, when present on a dependency object, /// should make the property browsable. /// public AttachedPropertyBrowsableWhenAttributePresentAttribute(Type attributeType) { if (attributeType == null) throw new ArgumentNullException("attributeType"); _attributeType = attributeType; } //----------------------------------------------------- // // Public Properties // //----------------------------------------------------- ////// Returns the attribute type passed into the constructor. /// public Type AttributeType { get { return _attributeType; } } //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- ////// Overrides Object.Equals to implement correct equality semantics for this /// attribute. /// public override bool Equals(object obj) { AttachedPropertyBrowsableWhenAttributePresentAttribute other = obj as AttachedPropertyBrowsableWhenAttributePresentAttribute; if (other == null) return false; return _attributeType == other._attributeType; } ////// Overrides Object.GetHashCode to implement correct hashing semantics. /// public override int GetHashCode() { return _attributeType.GetHashCode(); } //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ ////// Returns true if the dependency object class defines an attribute /// of the same type contained in this attribute. The attribute must /// differ from the "default" state of the attribute. /// internal override bool IsBrowsable(DependencyObject d, DependencyProperty dp) { if (d == null) throw new ArgumentNullException("d"); if (dp == null) throw new ArgumentNullException("dp"); Attribute a = TypeDescriptor.GetAttributes(d)[_attributeType]; return (a != null && !a.IsDefaultAttribute()); } //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ private Type _attributeType; } } // 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
- IResourceProvider.cs
- HttpListenerContext.cs
- IODescriptionAttribute.cs
- MULTI_QI.cs
- AccessDataSourceView.cs
- RowsCopiedEventArgs.cs
- WebPartAddingEventArgs.cs
- SHA384.cs
- unitconverter.cs
- InputBuffer.cs
- ApplicationException.cs
- ApplyTemplatesAction.cs
- IgnorePropertiesAttribute.cs
- EntityDescriptor.cs
- DataBindEngine.cs
- BamlVersionHeader.cs
- XmlMemberMapping.cs
- TreeView.cs
- BindingExpressionUncommonField.cs
- FieldNameLookup.cs
- AuthorizationSection.cs
- XhtmlBasicSelectionListAdapter.cs
- RewritingSimplifier.cs
- CollectionView.cs
- BinaryKeyIdentifierClause.cs
- ProjectionCamera.cs
- Root.cs
- SQLInt32.cs
- FastPropertyAccessor.cs
- RepeaterCommandEventArgs.cs
- RectAnimationUsingKeyFrames.cs
- ProcessHostMapPath.cs
- SpnegoTokenProvider.cs
- NumericExpr.cs
- CommandEventArgs.cs
- NamespaceImport.cs
- IisTraceWebEventProvider.cs
- EndpointDiscoveryElement.cs
- _IPv4Address.cs
- WeakHashtable.cs
- FixedElement.cs
- LineSegment.cs
- MultipartIdentifier.cs
- UrlMappingsModule.cs
- RadialGradientBrush.cs
- ParagraphVisual.cs
- PrintPreviewDialog.cs
- IndependentlyAnimatedPropertyMetadata.cs
- XmlQueryRuntime.cs
- SerializableAttribute.cs
- EditorZoneBase.cs
- XmlWriterSettings.cs
- UnsafeNativeMethods.cs
- SafeFileMapViewHandle.cs
- ExpandSegment.cs
- XamlFxTrace.cs
- DocumentPageViewAutomationPeer.cs
- TextSelection.cs
- ScriptIgnoreAttribute.cs
- HttpContextServiceHost.cs
- TextFindEngine.cs
- CoreSwitches.cs
- AutoSizeToolBoxItem.cs
- XamlFilter.cs
- Stack.cs
- XmlSchemaExternal.cs
- Authorization.cs
- TextServicesManager.cs
- SecurityDescriptor.cs
- ConvertersCollection.cs
- Publisher.cs
- EventHandlersDesigner.cs
- FullTrustAssembly.cs
- GestureRecognizer.cs
- RectangleGeometry.cs
- TreeNode.cs
- StringValidatorAttribute.cs
- SortedSetDebugView.cs
- AutoGeneratedField.cs
- DataGridViewControlCollection.cs
- ClrProviderManifest.cs
- WindowsFormsHostPropertyMap.cs
- FileLevelControlBuilderAttribute.cs
- WorkflowHostingResponseContext.cs
- EntityProviderServices.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- ChannelFactoryRefCache.cs
- TableItemStyle.cs
- AssertFilter.cs
- ColorBuilder.cs
- SearchForVirtualItemEventArgs.cs
- ToolStripCustomTypeDescriptor.cs
- SecurityDocument.cs
- ContentDefinition.cs
- PackagePart.cs
- LastQueryOperator.cs
- IntPtr.cs
- EventMap.cs
- UrlPath.cs
- RemoteWebConfigurationHost.cs