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
- FrameworkEventSource.cs
- SecureStringHasher.cs
- DataPagerCommandEventArgs.cs
- WaitForChangedResult.cs
- EntityReference.cs
- BoundField.cs
- CompareInfo.cs
- ClientScriptManager.cs
- RemoteWebConfigurationHostStream.cs
- XmlQueryStaticData.cs
- Trace.cs
- DragCompletedEventArgs.cs
- ControlUtil.cs
- ItemAutomationPeer.cs
- CopyNamespacesAction.cs
- DbConnectionPoolCounters.cs
- FacetChecker.cs
- RSAPKCS1KeyExchangeFormatter.cs
- OutputCacheProviderCollection.cs
- webeventbuffer.cs
- MimeFormImporter.cs
- FixedFlowMap.cs
- ResourceProviderFactory.cs
- DesignerCapabilities.cs
- UrlMappingsModule.cs
- CodeDelegateInvokeExpression.cs
- DtcInterfaces.cs
- ResourceDescriptionAttribute.cs
- TextContainerChangeEventArgs.cs
- DictionaryEntry.cs
- ResXDataNode.cs
- LiteralControl.cs
- DataGridAutoFormat.cs
- WebService.cs
- QueryServiceConfigHandle.cs
- MarkupExtensionParser.cs
- GridToolTip.cs
- WebPartTransformerAttribute.cs
- KeyPullup.cs
- UserPersonalizationStateInfo.cs
- DoWorkEventArgs.cs
- ResXResourceReader.cs
- LabelInfo.cs
- TdsParserStateObject.cs
- DoubleIndependentAnimationStorage.cs
- SqlDataSourceSelectingEventArgs.cs
- PreservationFileWriter.cs
- OdbcPermission.cs
- TypeDescriptorContext.cs
- SiteMapSection.cs
- OrderedDictionary.cs
- Latin1Encoding.cs
- CodeLinePragma.cs
- EntityDataSourceStatementEditor.cs
- TabControlCancelEvent.cs
- CreateUserErrorEventArgs.cs
- EncryptedHeader.cs
- EditorReuseAttribute.cs
- MenuItem.cs
- BooleanExpr.cs
- KernelTypeValidation.cs
- OSFeature.cs
- GAC.cs
- IndexerNameAttribute.cs
- Vector3DCollectionConverter.cs
- UpdatableGenericsFeature.cs
- DATA_BLOB.cs
- DurableOperationContext.cs
- DataControlFieldCollection.cs
- AnnouncementService.cs
- cache.cs
- KeyPullup.cs
- DataServiceExpressionVisitor.cs
- BindUriHelper.cs
- IsolatedStorageFile.cs
- ObjectDataSourceMethodEventArgs.cs
- ExpressionContext.cs
- CrossAppDomainChannel.cs
- ServiceContractListItem.cs
- SrgsItemList.cs
- InputScopeAttribute.cs
- TextCharacters.cs
- embossbitmapeffect.cs
- ToolStripProgressBar.cs
- ContextMenuService.cs
- WasAdminWrapper.cs
- Overlapped.cs
- TextEncodedRawTextWriter.cs
- CommonRemoteMemoryBlock.cs
- CoreSwitches.cs
- CultureMapper.cs
- EventItfInfo.cs
- ImageMetadata.cs
- StandardCommands.cs
- VirtualPath.cs
- JsonServiceDocumentSerializer.cs
- QuaternionConverter.cs
- Empty.cs
- DbProviderSpecificTypePropertyAttribute.cs
- Win32Native.cs