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
- DeadCharTextComposition.cs
- MessageProperties.cs
- Rfc2898DeriveBytes.cs
- ObfuscationAttribute.cs
- ValueType.cs
- BitmapEffectGeneralTransform.cs
- WindowsFormsSynchronizationContext.cs
- TypeUtil.cs
- DefaultValueConverter.cs
- StandardRuntimeEnumValidatorAttribute.cs
- CodeTryCatchFinallyStatement.cs
- GenericPrincipal.cs
- TraceSection.cs
- TreeViewDesigner.cs
- XmlSchemaAnnotation.cs
- ArrangedElement.cs
- ObjectPropertyMapping.cs
- ContractNamespaceAttribute.cs
- SamlSerializer.cs
- SqlDataReaderSmi.cs
- RijndaelManaged.cs
- FrameworkContentElementAutomationPeer.cs
- Resources.Designer.cs
- Compiler.cs
- AppearanceEditorPart.cs
- BuiltInExpr.cs
- SchemaCompiler.cs
- DateTimeFormat.cs
- Profiler.cs
- RouteItem.cs
- DataBinding.cs
- BooleanKeyFrameCollection.cs
- IPipelineRuntime.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- Pkcs9Attribute.cs
- PictureBoxDesigner.cs
- CommandConverter.cs
- ApplicationDirectory.cs
- TypeUsageBuilder.cs
- ClientFactory.cs
- PseudoWebRequest.cs
- ThreadAbortException.cs
- DecoderBestFitFallback.cs
- CustomServiceCredentials.cs
- DoubleAnimation.cs
- Brush.cs
- OleDbConnection.cs
- DataList.cs
- CompiledQuery.cs
- PropertyTabAttribute.cs
- OdbcConnectionString.cs
- CharacterMetrics.cs
- SchemeSettingElement.cs
- ScaleTransform.cs
- CaseInsensitiveOrdinalStringComparer.cs
- UrlPath.cs
- XsdDateTime.cs
- CacheSection.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- ProgressBar.cs
- ListControlBoundActionList.cs
- RunWorkerCompletedEventArgs.cs
- EncoderNLS.cs
- FrameworkContextData.cs
- WebScriptEnablingBehavior.cs
- CustomAttributeBuilder.cs
- HighContrastHelper.cs
- SectionUpdates.cs
- Keyboard.cs
- AppDomain.cs
- XmlnsCache.cs
- EndOfStreamException.cs
- FontSourceCollection.cs
- SerializationIncompleteException.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- TextEditorContextMenu.cs
- CheckedListBox.cs
- InlineCategoriesDocument.cs
- ParameterBuilder.cs
- ButtonPopupAdapter.cs
- OptimalBreakSession.cs
- AtomEntry.cs
- SafeCryptContextHandle.cs
- TextSerializer.cs
- MetadataArtifactLoaderResource.cs
- FormatVersion.cs
- FieldBuilder.cs
- StatusBarDesigner.cs
- DesignDataSource.cs
- ExpressionBinding.cs
- ResetableIterator.cs
- ListBox.cs
- EntityContainerAssociationSetEnd.cs
- ProxyWebPartManager.cs
- RegexFCD.cs
- XmlSchemaResource.cs
- HttpApplicationStateWrapper.cs
- DiscoveryClientBindingElement.cs
- HttpCacheVary.cs
- ArgIterator.cs