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
- IxmlLineInfo.cs
- DataSourceControlBuilder.cs
- Site.cs
- SelectionProcessor.cs
- CodeGenerator.cs
- HttpRequest.cs
- FormViewUpdateEventArgs.cs
- SafeNativeMethods.cs
- MimeXmlReflector.cs
- ListControl.cs
- PostBackOptions.cs
- WmpBitmapDecoder.cs
- OutgoingWebRequestContext.cs
- ClassDataContract.cs
- GregorianCalendar.cs
- SuppressIldasmAttribute.cs
- SelectionRange.cs
- InstanceCollisionException.cs
- SystemException.cs
- SqlDataSourceAdvancedOptionsForm.cs
- XmlSchemaComplexContentRestriction.cs
- XmlAttributeCollection.cs
- XmlSerializerNamespaces.cs
- MSAANativeProvider.cs
- _Semaphore.cs
- HelpKeywordAttribute.cs
- DesignerValidatorAdapter.cs
- DataGridViewDataConnection.cs
- Effect.cs
- HashAlgorithm.cs
- UnionExpr.cs
- SortQuery.cs
- listitem.cs
- ObservableCollection.cs
- DesignerVerbToolStripMenuItem.cs
- BrowserCapabilitiesFactory.cs
- ListItemCollection.cs
- NameValuePermission.cs
- OdbcConnectionString.cs
- Evaluator.cs
- WindowsSysHeader.cs
- PageCache.cs
- WindowsGraphics2.cs
- GenericFlowSwitchHelper.cs
- XmlDownloadManager.cs
- OpCellTreeNode.cs
- FigureHelper.cs
- EastAsianLunisolarCalendar.cs
- AsyncOperationContext.cs
- FramingEncoders.cs
- TreeNodeStyle.cs
- ADMembershipProvider.cs
- HtmlInputCheckBox.cs
- DiscardableAttribute.cs
- BaseValidatorDesigner.cs
- CircleHotSpot.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- DataGridRowAutomationPeer.cs
- ReferencedType.cs
- SingleObjectCollection.cs
- PersonalizationDictionary.cs
- M3DUtil.cs
- HttpServerUtilityBase.cs
- UnknownBitmapEncoder.cs
- SafeRightsManagementEnvironmentHandle.cs
- DependencyPropertyKind.cs
- CFGGrammar.cs
- ListComponentEditor.cs
- ToolStripRenderer.cs
- BuildProviderCollection.cs
- Internal.cs
- SHA384.cs
- XmlChoiceIdentifierAttribute.cs
- DesignerValidatorAdapter.cs
- AsyncOperation.cs
- ElementProxy.cs
- CompiledXpathExpr.cs
- ClientData.cs
- EventItfInfo.cs
- OracleBinary.cs
- SelectionItemProviderWrapper.cs
- ExecutorLocksHeldException.cs
- AuthenticatingEventArgs.cs
- ZipIOExtraField.cs
- MeasureItemEvent.cs
- FileDialogCustomPlaces.cs
- ImageCodecInfo.cs
- SaveFileDialog.cs
- NetSectionGroup.cs
- PropertyIDSet.cs
- filewebrequest.cs
- OdbcRowUpdatingEvent.cs
- PeerNameRecord.cs
- WindowsListViewItem.cs
- Evidence.cs
- Line.cs
- DesignerSerializerAttribute.cs
- WebPartConnection.cs
- Win32SafeHandles.cs
- PriorityBindingExpression.cs