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
- CodeMethodMap.cs
- CallbackValidator.cs
- MergablePropertyAttribute.cs
- SingleAnimationUsingKeyFrames.cs
- OleDbConnectionFactory.cs
- GeometryDrawing.cs
- Content.cs
- DocumentSchemaValidator.cs
- StringSorter.cs
- MultiTrigger.cs
- ModuleConfigurationInfo.cs
- C14NUtil.cs
- DisplayNameAttribute.cs
- HierarchicalDataBoundControl.cs
- FileDialog_Vista_Interop.cs
- X509Certificate2.cs
- FileDataSourceCache.cs
- CacheMemory.cs
- Pair.cs
- LineGeometry.cs
- _ScatterGatherBuffers.cs
- DefaultBindingPropertyAttribute.cs
- GetWinFXPath.cs
- UiaCoreTypesApi.cs
- Vector.cs
- TraceProvider.cs
- Itemizer.cs
- ResourceDisplayNameAttribute.cs
- TraceUtility.cs
- DCSafeHandle.cs
- VisualBasicDesignerHelper.cs
- CodeArgumentReferenceExpression.cs
- RightNameExpirationInfoPair.cs
- XmlSchemaAppInfo.cs
- FontInfo.cs
- ImportContext.cs
- ApplicationException.cs
- WebEvents.cs
- ControlType.cs
- SqlConnectionPoolProviderInfo.cs
- AccessedThroughPropertyAttribute.cs
- DelimitedListTraceListener.cs
- NameValuePermission.cs
- WebPartConnectionCollection.cs
- DbConnectionPoolCounters.cs
- ListViewPagedDataSource.cs
- DataSourceCache.cs
- ExpressionCopier.cs
- DataServiceQuery.cs
- AlignmentYValidation.cs
- XamlPathDataSerializer.cs
- ReferenceSchema.cs
- TextSerializer.cs
- TypeInitializationException.cs
- RubberbandSelector.cs
- WpfXamlLoader.cs
- XPathMultyIterator.cs
- OdbcDataAdapter.cs
- InkPresenterAutomationPeer.cs
- RunInstallerAttribute.cs
- UntrustedRecipientException.cs
- XPathSelfQuery.cs
- IsolatedStorage.cs
- Simplifier.cs
- HandoffBehavior.cs
- InternalsVisibleToAttribute.cs
- CommentGlyph.cs
- EdmValidator.cs
- SimpleRecyclingCache.cs
- LocalizedNameDescriptionPair.cs
- BezierSegment.cs
- SoapHeaderAttribute.cs
- GZipStream.cs
- ExpressionNode.cs
- BaseParagraph.cs
- ResourcePool.cs
- ProcessInfo.cs
- tibetanshape.cs
- DragEvent.cs
- SqlProcedureAttribute.cs
- StringResourceManager.cs
- MatchNoneMessageFilter.cs
- JapaneseCalendar.cs
- AuthenticationConfig.cs
- DecoderBestFitFallback.cs
- CodeSnippetExpression.cs
- ActiveDocumentEvent.cs
- EmptyReadOnlyDictionaryInternal.cs
- ConfigXmlText.cs
- TextContainerChangedEventArgs.cs
- TransformPattern.cs
- LocatorManager.cs
- MethodSignatureGenerator.cs
- CompositeDataBoundControl.cs
- ReflectTypeDescriptionProvider.cs
- nulltextnavigator.cs
- SQLMoneyStorage.cs
- RegisteredScript.cs
- AppSettingsReader.cs
- MissingSatelliteAssemblyException.cs