Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextAction.cs
- WebPartDisplayModeCollection.cs
- SimpleMailWebEventProvider.cs
- RuntimeIdentifierPropertyAttribute.cs
- XmlArrayAttribute.cs
- TableLayout.cs
- DecoderBestFitFallback.cs
- MouseGesture.cs
- SettingsPropertyValue.cs
- ZipIOLocalFileDataDescriptor.cs
- FullTrustAssembly.cs
- PageFunction.cs
- PagesChangedEventArgs.cs
- ColorDialog.cs
- AlternateView.cs
- Encoding.cs
- FileDialog_Vista_Interop.cs
- HttpResponseHeader.cs
- ColumnReorderedEventArgs.cs
- SmiContext.cs
- ControlPaint.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- ExtensibleClassFactory.cs
- EastAsianLunisolarCalendar.cs
- DBPropSet.cs
- PeerNameRegistration.cs
- StyleModeStack.cs
- TableAutomationPeer.cs
- CqlQuery.cs
- SaveFileDialog.cs
- GridLengthConverter.cs
- Queue.cs
- KeyGestureValueSerializer.cs
- Label.cs
- CustomCategoryAttribute.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- SafeCryptContextHandle.cs
- ZipIOLocalFileBlock.cs
- XmlChildEnumerator.cs
- XmlSchemaComplexContentExtension.cs
- SinglePageViewer.cs
- ProfileGroupSettingsCollection.cs
- TimerEventSubscriptionCollection.cs
- XmlSchemaFacet.cs
- HistoryEventArgs.cs
- WinFormsSecurity.cs
- wgx_sdk_version.cs
- AspCompat.cs
- TcpTransportElement.cs
- IUnknownConstantAttribute.cs
- Util.cs
- ProgressBar.cs
- XPathException.cs
- JapaneseCalendar.cs
- MarkupExtensionParser.cs
- LayoutDump.cs
- NamespaceCollection.cs
- BaseUriHelper.cs
- BinaryFormatterWriter.cs
- InvalidOperationException.cs
- TypeSystemProvider.cs
- TextRunCache.cs
- SerialPort.cs
- VerbConverter.cs
- SkewTransform.cs
- TemplateBindingExpression.cs
- PeerNodeAddress.cs
- PropertyGroupDescription.cs
- EncryptedKey.cs
- EnumerableCollectionView.cs
- VirtualDirectoryMapping.cs
- TextModifierScope.cs
- PenCursorManager.cs
- D3DImage.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- WhitespaceRuleLookup.cs
- ListSortDescriptionCollection.cs
- RowToParametersTransformer.cs
- FileVersionInfo.cs
- TailCallAnalyzer.cs
- VirtualPathProvider.cs
- TemplateControlParser.cs
- baseshape.cs
- Triangle.cs
- Array.cs
- ConfigurationCollectionAttribute.cs
- NamespaceImport.cs
- VectorAnimation.cs
- DataListCommandEventArgs.cs
- ContextBase.cs
- ThreadAttributes.cs
- NetworkCredential.cs
- Point.cs
- AuthenticationConfig.cs
- BufferedGenericXmlSecurityToken.cs
- CallbackValidator.cs
- FormatterConverter.cs
- ReadWriteObjectLock.cs
- SchemaMapping.cs
- DBDataPermission.cs