Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / System / Windows / AttachedPropertyBrowsableWhenAttributePresentAttribute.cs / 1305600 / 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
- ZipIOBlockManager.cs
- ZoneButton.cs
- StringAnimationUsingKeyFrames.cs
- CodeGenerator.cs
- SiteMapDataSource.cs
- TraceEventCache.cs
- WindowsAuthenticationModule.cs
- UnsafeNativeMethods.cs
- CheckBoxAutomationPeer.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- EnumUnknown.cs
- AsymmetricKeyExchangeFormatter.cs
- TreeIterators.cs
- Transform3D.cs
- Int16KeyFrameCollection.cs
- FormsIdentity.cs
- WebPartTransformerCollection.cs
- ComponentCache.cs
- DbParameterCollectionHelper.cs
- MeshGeometry3D.cs
- _KerberosClient.cs
- MailAddress.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- BitmapDownload.cs
- XmlSchemaComplexContentExtension.cs
- KeyValueInternalCollection.cs
- KeyTimeConverter.cs
- DataGridView.cs
- AlphabeticalEnumConverter.cs
- ClientSideQueueItem.cs
- HostedTcpTransportManager.cs
- GetBrowserTokenRequest.cs
- DockPatternIdentifiers.cs
- AnonymousIdentificationModule.cs
- GeneralTransform.cs
- EffectiveValueEntry.cs
- codemethodreferenceexpression.cs
- ListViewPagedDataSource.cs
- WebUtil.cs
- Misc.cs
- RegexWriter.cs
- HttpConfigurationSystem.cs
- OutArgument.cs
- StringUtil.cs
- SqlUDTStorage.cs
- DataGridCommandEventArgs.cs
- DrawingImage.cs
- SoapIncludeAttribute.cs
- MenuItem.cs
- Label.cs
- Avt.cs
- NavigationCommands.cs
- BasicCellRelation.cs
- SequentialOutput.cs
- PackagePartCollection.cs
- Bitmap.cs
- TextChangedEventArgs.cs
- CommonDialog.cs
- CacheMemory.cs
- ConstantSlot.cs
- WebPartConnection.cs
- FaultDescriptionCollection.cs
- ObjectMemberMapping.cs
- ClientRuntimeConfig.cs
- CorrelationActionMessageFilter.cs
- BitmapSourceSafeMILHandle.cs
- TaiwanLunisolarCalendar.cs
- TileBrush.cs
- GetCertificateRequest.cs
- ImmutableAssemblyCacheEntry.cs
- WorkflowMessageEventArgs.cs
- XmlILTrace.cs
- SystemFonts.cs
- RadioButton.cs
- MoveSizeWinEventHandler.cs
- WebPartZoneDesigner.cs
- Schema.cs
- CompositeDataBoundControl.cs
- EventHandlersStore.cs
- MessageQueue.cs
- DrawingAttributes.cs
- FixedSOMFixedBlock.cs
- DesignerInterfaces.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- safex509handles.cs
- FusionWrap.cs
- TextDecorationLocationValidation.cs
- MetaTable.cs
- DropTarget.cs
- DesignTimeSiteMapProvider.cs
- ExtendedProperty.cs
- XhtmlBasicPageAdapter.cs
- HtmlInputSubmit.cs
- Substitution.cs
- odbcmetadatafactory.cs
- SoapFormatter.cs
- ExtractCollection.cs
- SamlEvidence.cs
- WebConfigurationHostFileChange.cs
- DropTarget.cs