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
- Attributes.cs
- InvalidPropValue.cs
- UnsafeNativeMethods.cs
- RequestNavigateEventArgs.cs
- DefaultBinder.cs
- TempEnvironment.cs
- FieldNameLookup.cs
- GlobalItem.cs
- MachineKeySection.cs
- AuthenticationException.cs
- DataGridLengthConverter.cs
- MediaElementAutomationPeer.cs
- DataIdProcessor.cs
- OleDbTransaction.cs
- BlurBitmapEffect.cs
- CachedTypeface.cs
- XmlSchemaSimpleTypeRestriction.cs
- CachedFontFamily.cs
- EventProviderWriter.cs
- MSAAWinEventWrap.cs
- ObsoleteAttribute.cs
- IApplicationTrustManager.cs
- SqlRecordBuffer.cs
- SignatureToken.cs
- ConstructorBuilder.cs
- XPathNavigatorKeyComparer.cs
- GridView.cs
- CollectionType.cs
- RegexStringValidatorAttribute.cs
- MatrixAnimationBase.cs
- UrlMapping.cs
- XmlDocumentType.cs
- Keywords.cs
- ProgressBarHighlightConverter.cs
- MessagePropertyFilter.cs
- InternalControlCollection.cs
- QuadraticBezierSegment.cs
- pingexception.cs
- SpeechDetectedEventArgs.cs
- TypeSystem.cs
- DllNotFoundException.cs
- HtmlElementCollection.cs
- followingsibling.cs
- ProfileBuildProvider.cs
- TrackingExtract.cs
- ExpandCollapsePattern.cs
- Maps.cs
- UdpDiscoveryMessageFilter.cs
- BinaryMethodMessage.cs
- MailWebEventProvider.cs
- UniformGrid.cs
- SecurityHeader.cs
- EventToken.cs
- SudsParser.cs
- Pen.cs
- ContainerVisual.cs
- StreamWriter.cs
- InitializationEventAttribute.cs
- QueryableFilterRepeater.cs
- TemplateXamlParser.cs
- LocalizableResourceBuilder.cs
- RunInstallerAttribute.cs
- AbandonedMutexException.cs
- DataControlFieldCollection.cs
- DocumentSchemaValidator.cs
- MissingMemberException.cs
- UnmanagedMarshal.cs
- XmlDomTextWriter.cs
- HtmlImageAdapter.cs
- StickyNoteHelper.cs
- AttachedAnnotation.cs
- SystemFonts.cs
- NTAccount.cs
- Control.cs
- ExtendedProtectionPolicy.cs
- XmlLinkedNode.cs
- KernelTypeValidation.cs
- AsyncResult.cs
- Substitution.cs
- RelatedCurrencyManager.cs
- NumberSubstitution.cs
- GridItemPattern.cs
- PageCatalogPart.cs
- _ConnectionGroup.cs
- TaskForm.cs
- UserControl.cs
- lengthconverter.cs
- QuaternionRotation3D.cs
- TransportElement.cs
- Attributes.cs
- COM2AboutBoxPropertyDescriptor.cs
- DbConnectionPoolOptions.cs
- EntityDataSourceSelectedEventArgs.cs
- DataGridViewComboBoxEditingControl.cs
- TabPage.cs
- XmlSchemaComplexContent.cs
- Processor.cs
- AssemblyAssociatedContentFileAttribute.cs
- PointAnimation.cs
- MonthChangedEventArgs.cs