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
- HttpWebRequest.cs
- FormsAuthenticationModule.cs
- InvalidPipelineStoreException.cs
- WeakEventTable.cs
- shaperfactoryquerycacheentry.cs
- Literal.cs
- SafeRightsManagementSessionHandle.cs
- FieldDescriptor.cs
- webbrowsersite.cs
- ObjectStateManager.cs
- SoapServerMethod.cs
- MinMaxParagraphWidth.cs
- TypefaceMetricsCache.cs
- EventSourceCreationData.cs
- RegexCode.cs
- AutoResizedEvent.cs
- TreeViewImageGenerator.cs
- HasCopySemanticsAttribute.cs
- PathSegment.cs
- EntityConnectionStringBuilderItem.cs
- FigureParaClient.cs
- ListBoxChrome.cs
- EdmConstants.cs
- ExtensionWindowResizeGrip.cs
- DataGridViewColumnStateChangedEventArgs.cs
- CorePropertiesFilter.cs
- TransactionException.cs
- SocketException.cs
- DetailsViewDeleteEventArgs.cs
- ArraySortHelper.cs
- DataControlExtensions.cs
- AudioFormatConverter.cs
- QualifiedCellIdBoolean.cs
- TextSpanModifier.cs
- X500Name.cs
- XmlSchemaProviderAttribute.cs
- Lease.cs
- ClientSettingsProvider.cs
- CodeDomConfigurationHandler.cs
- DataGridViewElement.cs
- MsmqIntegrationProcessProtocolHandler.cs
- WorkerRequest.cs
- TdsParserStateObject.cs
- SizeConverter.cs
- TextWriterTraceListener.cs
- Run.cs
- ConfigXmlElement.cs
- TaiwanLunisolarCalendar.cs
- AuthStoreRoleProvider.cs
- SchemaMerger.cs
- FrameworkContentElement.cs
- OutputCacheSection.cs
- WSHttpBindingBaseElement.cs
- coordinatorfactory.cs
- WebServiceErrorEvent.cs
- RoutedEventValueSerializer.cs
- ConnectionManagementElement.cs
- ByteStreamMessage.cs
- WinEventHandler.cs
- Drawing.cs
- EnumValidator.cs
- LineGeometry.cs
- Filter.cs
- Deflater.cs
- odbcmetadatacollectionnames.cs
- DataGridViewRowPostPaintEventArgs.cs
- ScriptHandlerFactory.cs
- EventPropertyMap.cs
- WebContentFormatHelper.cs
- MobileUserControlDesigner.cs
- TypeGenericEnumerableViewSchema.cs
- MatrixConverter.cs
- Rect3D.cs
- ArgIterator.cs
- Graphics.cs
- WindowsListViewItem.cs
- ImageBrush.cs
- StreamGeometry.cs
- BoolExpression.cs
- SafeHandles.cs
- ComponentConverter.cs
- OrderedEnumerableRowCollection.cs
- InputBinding.cs
- XmlSchemaExporter.cs
- RightsController.cs
- ImplicitInputBrush.cs
- Scene3D.cs
- SmtpAuthenticationManager.cs
- HttpServerVarsCollection.cs
- EntityDesignerBuildProvider.cs
- FormViewDeletedEventArgs.cs
- PointKeyFrameCollection.cs
- SortedDictionary.cs
- ShimAsPublicXamlType.cs
- IOException.cs
- XmlSchemaExporter.cs
- NetMsmqSecurity.cs
- hresults.cs
- DetailsViewRow.cs
- SoapSchemaImporter.cs