Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlServer2KCompatibilityCheck.cs
- DesignerLoader.cs
- TextTreeText.cs
- ListDictionaryInternal.cs
- UserInitiatedNavigationPermission.cs
- Window.cs
- PartialCachingControl.cs
- VerificationAttribute.cs
- EUCJPEncoding.cs
- Command.cs
- InstancePersistenceException.cs
- InfoCardSchemas.cs
- PhysicalAddress.cs
- Condition.cs
- TypeRefElement.cs
- PartialTrustVisibleAssemblyCollection.cs
- HostedTransportConfigurationBase.cs
- XPathNode.cs
- XhtmlTextWriter.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- JsonReaderWriterFactory.cs
- LocalizabilityAttribute.cs
- GeometryHitTestResult.cs
- PropertyRef.cs
- UnconditionalPolicy.cs
- ReachDocumentPageSerializer.cs
- SrgsRuleRef.cs
- XmlWrappingWriter.cs
- InstanceNormalEvent.cs
- Transactions.cs
- HierarchicalDataBoundControl.cs
- Membership.cs
- AssemblyFilter.cs
- DataColumn.cs
- OdbcParameter.cs
- CriticalFinalizerObject.cs
- HttpGetProtocolImporter.cs
- PasswordRecovery.cs
- SystemIPInterfaceStatistics.cs
- DefaultTextStore.cs
- EntityParameterCollection.cs
- TextTreeTextElementNode.cs
- ObjectQueryProvider.cs
- HttpCacheVary.cs
- ToolStripRenderEventArgs.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- BooleanToVisibilityConverter.cs
- ControlPropertyNameConverter.cs
- DataTemplateKey.cs
- Duration.cs
- DropShadowBitmapEffect.cs
- OdbcEnvironment.cs
- ClientUrlResolverWrapper.cs
- ErrorHandler.cs
- SqlDataSourceEnumerator.cs
- ResourceExpressionBuilder.cs
- SettingsSection.cs
- DiscoveryClientRequestChannel.cs
- TabPage.cs
- CharAnimationUsingKeyFrames.cs
- FontUnitConverter.cs
- XslVisitor.cs
- webeventbuffer.cs
- CompressedStack.cs
- SqlCaseSimplifier.cs
- SqlBuilder.cs
- WebPartActionVerb.cs
- RoleGroupCollection.cs
- ProcessModelInfo.cs
- FullTextState.cs
- ThreadTrace.cs
- EmbossBitmapEffect.cs
- UTF7Encoding.cs
- Translator.cs
- TextTreeUndo.cs
- XmlDocument.cs
- CodeStatement.cs
- PasswordBox.cs
- BamlRecordReader.cs
- DialogWindow.cs
- ConfigurationElementCollection.cs
- ScalarOps.cs
- SqlParameterizer.cs
- SoapFault.cs
- RegisteredExpandoAttribute.cs
- AppSettingsExpressionEditor.cs
- SafeNativeMethods.cs
- EmptyEnumerable.cs
- DataGridDetailsPresenter.cs
- WebRequestModuleElement.cs
- WebColorConverter.cs
- RectIndependentAnimationStorage.cs
- EncryptedReference.cs
- SmtpAuthenticationManager.cs
- GeneralTransform.cs
- RenderData.cs
- ConnectionStringSettings.cs
- DBSchemaTable.cs
- BlobPersonalizationState.cs
- OciHandle.cs