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
- LabelAutomationPeer.cs
- ObjectContextServiceProvider.cs
- ObfuscateAssemblyAttribute.cs
- CollectionConverter.cs
- ObjectDataSourceDisposingEventArgs.cs
- WebPartsSection.cs
- SystemColors.cs
- DataControlPagerLinkButton.cs
- AlphaSortedEnumConverter.cs
- TagNameToTypeMapper.cs
- FormsAuthenticationTicket.cs
- VersionPair.cs
- NavigationWindow.cs
- DataGridViewComboBoxCell.cs
- sqlinternaltransaction.cs
- CodeDirectoryCompiler.cs
- Constraint.cs
- StreamAsIStream.cs
- StreamSecurityUpgradeInitiatorAsyncResult.cs
- nulltextnavigator.cs
- OperationGenerator.cs
- ObjectItemAssemblyLoader.cs
- Quad.cs
- GroupStyle.cs
- ValueUnavailableException.cs
- FrameworkElementFactory.cs
- Logging.cs
- AccessorTable.cs
- AppDomainManager.cs
- Vector3DAnimation.cs
- EventLogPermissionAttribute.cs
- Label.cs
- Misc.cs
- ContractBase.cs
- WebRequestModuleElement.cs
- PingOptions.cs
- ListControlConvertEventArgs.cs
- documentation.cs
- GetPageNumberCompletedEventArgs.cs
- serverconfig.cs
- OleDbRowUpdatedEvent.cs
- PointConverter.cs
- JsonStringDataContract.cs
- FacetDescriptionElement.cs
- DbConnectionClosed.cs
- SQLBinary.cs
- UnitySerializationHolder.cs
- _ConnectStream.cs
- XmlProcessingInstruction.cs
- XamlUtilities.cs
- CodeExporter.cs
- TextAnchor.cs
- HttpCachePolicyElement.cs
- TypeConverter.cs
- DocumentViewerBase.cs
- SynchronizationContextHelper.cs
- InternalCache.cs
- TextPointer.cs
- ConstructorNeedsTagAttribute.cs
- DragDropManager.cs
- LambdaExpression.cs
- Documentation.cs
- RuleSettingsCollection.cs
- RootDesignerSerializerAttribute.cs
- TraceContextRecord.cs
- FormDesigner.cs
- RecognizedWordUnit.cs
- CodeTypeReferenceCollection.cs
- FileRecordSequenceCompletedAsyncResult.cs
- RenderTargetBitmap.cs
- ResourceProviderFactory.cs
- XmlCharCheckingReader.cs
- TypefaceCollection.cs
- CancelEventArgs.cs
- GridView.cs
- CommandID.cs
- MetadataArtifactLoaderCompositeFile.cs
- BitmapDownload.cs
- GeometryGroup.cs
- ContentType.cs
- figurelength.cs
- CharKeyFrameCollection.cs
- SpeechDetectedEventArgs.cs
- MimeWriter.cs
- FrameworkElementFactoryMarkupObject.cs
- ObjectPersistData.cs
- RenderDataDrawingContext.cs
- ExpressionWriter.cs
- DesignerVerb.cs
- RuleRefElement.cs
- xsdvalidator.cs
- WindowsFormsHostAutomationPeer.cs
- TypeUnloadedException.cs
- WindowsRegion.cs
- Timeline.cs
- HotSpotCollection.cs
- SmiConnection.cs
- RuleAction.cs
- Win32MouseDevice.cs
- ToolStripPanelDesigner.cs