Code:
/ 4.0 / 4.0 / 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. 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
- ActivityTypeDesigner.xaml.cs
- UnsafeNativeMethods.cs
- StructuralType.cs
- WebPartConnection.cs
- DesignerEditorPartChrome.cs
- DataGridViewToolTip.cs
- ControlBuilder.cs
- SizeConverter.cs
- BinaryNode.cs
- SortableBindingList.cs
- DbProviderConfigurationHandler.cs
- ValidationErrorCollection.cs
- TypeSemantics.cs
- RoutedEventConverter.cs
- BrowserDefinition.cs
- Rotation3DKeyFrameCollection.cs
- ConfigurationSettings.cs
- SpeakCompletedEventArgs.cs
- ColumnCollection.cs
- TrackingProvider.cs
- QilNode.cs
- Style.cs
- UserInitiatedNavigationPermission.cs
- DbConnectionOptions.cs
- OutputScope.cs
- PaintEvent.cs
- ClientScriptManagerWrapper.cs
- BitmapPalette.cs
- EntityStoreSchemaFilterEntry.cs
- UITypeEditor.cs
- TypeBinaryExpression.cs
- WebRequestModuleElementCollection.cs
- SoapHelper.cs
- DeclarativeCatalogPartDesigner.cs
- SemanticTag.cs
- MD5CryptoServiceProvider.cs
- Pkcs7Signer.cs
- StreamResourceInfo.cs
- LongTypeConverter.cs
- RNGCryptoServiceProvider.cs
- TimelineGroup.cs
- PermissionSetEnumerator.cs
- DataGridViewHitTestInfo.cs
- MainMenu.cs
- Icon.cs
- Point4D.cs
- DeflateEmulationStream.cs
- XmlAttributeOverrides.cs
- StatusBar.cs
- ThreadSafeList.cs
- _Rfc2616CacheValidators.cs
- SevenBitStream.cs
- HtmlInputHidden.cs
- ListViewCancelEventArgs.cs
- Timer.cs
- TreeNodeStyleCollection.cs
- Shared.cs
- Compiler.cs
- SqlIdentifier.cs
- TextView.cs
- ClientScriptManager.cs
- ProfileProvider.cs
- SafeHandle.cs
- CrossSiteScriptingValidation.cs
- IsolatedStorageFileStream.cs
- ExpressionBuilder.cs
- InvokeDelegate.cs
- Expression.cs
- DataGridViewSortCompareEventArgs.cs
- FastEncoder.cs
- TextTreeUndoUnit.cs
- SoapProcessingBehavior.cs
- ADConnectionHelper.cs
- PersonalizationStateInfo.cs
- DataGridViewCellStyleChangedEventArgs.cs
- ConsumerConnectionPointCollection.cs
- DecimalKeyFrameCollection.cs
- GeometryModel3D.cs
- ConfigDefinitionUpdates.cs
- TextServicesDisplayAttributePropertyRanges.cs
- PresentationSource.cs
- FixedStringLookup.cs
- DispatcherSynchronizationContext.cs
- DrawingAttributes.cs
- HitTestWithPointDrawingContextWalker.cs
- MessageQueuePermissionEntry.cs
- TakeQueryOptionExpression.cs
- FrameDimension.cs
- Attributes.cs
- DocumentGridPage.cs
- XMLSchema.cs
- Convert.cs
- FixedSOMTableRow.cs
- DateBoldEvent.cs
- ComponentDesigner.cs
- LinkDesigner.cs
- AccessedThroughPropertyAttribute.cs
- VersionedStreamOwner.cs
- TemplateParser.cs
- InstanceDescriptor.cs