Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / ComponentModel / DependencyPropertyAttribute.cs / 1305600 / DependencyPropertyAttribute.cs
namespace MS.Internal.ComponentModel
{
using System;
using System.Windows;
///
/// This attribute is synthesized by our DependencyObjectProvider
/// to relate a property descriptor back to a dependency property.
///
[AttributeUsage(AttributeTargets.Method)]
internal sealed class DependencyPropertyAttribute : Attribute
{
//------------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
///
/// Creates a new DependencyPropertyAttribute for the given dependency property.
///
internal DependencyPropertyAttribute(DependencyProperty dependencyProperty, bool isAttached)
{
if (dependencyProperty == null) throw new ArgumentNullException("dependencyProperty");
_dp = dependencyProperty;
_isAttached = isAttached;
}
#endregion Constructors
//-----------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
///
/// Override of Object.Equals that returns true when the dependency
/// property contained within each attribute is the same.
///
public override bool Equals(object value)
{
DependencyPropertyAttribute da = value as DependencyPropertyAttribute;
if (da != null &&
object.ReferenceEquals(da._dp, _dp) &&
da._isAttached == _isAttached)
{
return true;
}
return false;
}
///
/// Override of Object.GetHashCode();
///
public override int GetHashCode()
{
return _dp.GetHashCode();
}
#endregion Public Methods
//------------------------------------------------------
//
// Public Operators
//
//-----------------------------------------------------
//------------------------------------------------------
//
// Public Properties
//
//------------------------------------------------------
#region Public Properties
///
/// Overrides Attribute.TypeId to be unique with respect to
/// other dependency property attributes.c
///
public override object TypeId
{
get { return typeof(DependencyPropertyAttribute); }
}
#endregion Public Properties
//-----------------------------------------------------
//
// Public Events
//
//------------------------------------------------------
//-----------------------------------------------------
//
// Internal Properties
//
//-----------------------------------------------------
#region Internal Properties
///
/// Returns whether the dependency property is an attached
/// property.
///
internal bool IsAttached
{
get { return _isAttached; }
}
///
/// Returns the dependency property instance this attribute is
/// associated with.
///
internal DependencyProperty DependencyProperty
{
get { return _dp; }
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Fields
//
//------------------------------------------------------
#region Private Fields
private DependencyProperty _dp;
private bool _isAttached;
#endregion Private Fields
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace MS.Internal.ComponentModel
{
using System;
using System.Windows;
///
/// This attribute is synthesized by our DependencyObjectProvider
/// to relate a property descriptor back to a dependency property.
///
[AttributeUsage(AttributeTargets.Method)]
internal sealed class DependencyPropertyAttribute : Attribute
{
//------------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
///
/// Creates a new DependencyPropertyAttribute for the given dependency property.
///
internal DependencyPropertyAttribute(DependencyProperty dependencyProperty, bool isAttached)
{
if (dependencyProperty == null) throw new ArgumentNullException("dependencyProperty");
_dp = dependencyProperty;
_isAttached = isAttached;
}
#endregion Constructors
//-----------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
///
/// Override of Object.Equals that returns true when the dependency
/// property contained within each attribute is the same.
///
public override bool Equals(object value)
{
DependencyPropertyAttribute da = value as DependencyPropertyAttribute;
if (da != null &&
object.ReferenceEquals(da._dp, _dp) &&
da._isAttached == _isAttached)
{
return true;
}
return false;
}
///
/// Override of Object.GetHashCode();
///
public override int GetHashCode()
{
return _dp.GetHashCode();
}
#endregion Public Methods
//------------------------------------------------------
//
// Public Operators
//
//-----------------------------------------------------
//------------------------------------------------------
//
// Public Properties
//
//------------------------------------------------------
#region Public Properties
///
/// Overrides Attribute.TypeId to be unique with respect to
/// other dependency property attributes.c
///
public override object TypeId
{
get { return typeof(DependencyPropertyAttribute); }
}
#endregion Public Properties
//-----------------------------------------------------
//
// Public Events
//
//------------------------------------------------------
//-----------------------------------------------------
//
// Internal Properties
//
//-----------------------------------------------------
#region Internal Properties
///
/// Returns whether the dependency property is an attached
/// property.
///
internal bool IsAttached
{
get { return _isAttached; }
}
///
/// Returns the dependency property instance this attribute is
/// associated with.
///
internal DependencyProperty DependencyProperty
{
get { return _dp; }
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Fields
//
//------------------------------------------------------
#region Private Fields
private DependencyProperty _dp;
private bool _isAttached;
#endregion Private Fields
}
}
// 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
- ProxyWebPart.cs
- XmlSchemaInferenceException.cs
- ElementHost.cs
- SchemaCreator.cs
- TriggerCollection.cs
- OpCopier.cs
- QilUnary.cs
- ProvidePropertyAttribute.cs
- DataObjectMethodAttribute.cs
- CacheOutputQuery.cs
- UnlockCardRequest.cs
- HostProtectionPermission.cs
- CodeParameterDeclarationExpressionCollection.cs
- ChangePassword.cs
- ConnectionPointCookie.cs
- EventSinkHelperWriter.cs
- WebPartsSection.cs
- UIElementParaClient.cs
- TextViewDesigner.cs
- CommentEmitter.cs
- ExtensionQuery.cs
- CustomAttributeSerializer.cs
- MessageSecurityOverHttp.cs
- FileUtil.cs
- LogWriteRestartAreaAsyncResult.cs
- EventsTab.cs
- GridSplitterAutomationPeer.cs
- SqlNotificationEventArgs.cs
- DeferredRunTextReference.cs
- DataGridAutoFormat.cs
- XsltSettings.cs
- IndexedString.cs
- SelectorItemAutomationPeer.cs
- Int64KeyFrameCollection.cs
- SessionStateModule.cs
- HttpChannelHelper.cs
- TextReturnReader.cs
- CursorConverter.cs
- Crypto.cs
- SqlBooleanizer.cs
- TypeInformation.cs
- ExtentCqlBlock.cs
- RoleGroup.cs
- HatchBrush.cs
- WebPartsPersonalizationAuthorization.cs
- XmlSerializerNamespaces.cs
- CompilerCollection.cs
- StructuralType.cs
- BitmapCodecInfo.cs
- ObjectNavigationPropertyMapping.cs
- BitStack.cs
- CorePropertiesFilter.cs
- TimeSpanValidatorAttribute.cs
- RunClient.cs
- NativeCompoundFileAPIs.cs
- DiscoveryClientProtocol.cs
- TypedRowGenerator.cs
- baseaxisquery.cs
- Command.cs
- FreezableDefaultValueFactory.cs
- EndpointAddressAugust2004.cs
- WebPermission.cs
- CustomTypeDescriptor.cs
- HttpModuleActionCollection.cs
- HtmlInputCheckBox.cs
- ObjectDataProvider.cs
- HttpAsyncResult.cs
- FlowLayoutSettings.cs
- DataBindingCollectionEditor.cs
- ObservableDictionary.cs
- SqlMethods.cs
- HttpWrapper.cs
- StrongNameMembershipCondition.cs
- Span.cs
- DaylightTime.cs
- WebRequest.cs
- MouseDevice.cs
- FolderLevelBuildProvider.cs
- DataGrid.cs
- TreeViewImageIndexConverter.cs
- TextBounds.cs
- XmlText.cs
- StringKeyFrameCollection.cs
- EntityType.cs
- BaseInfoTable.cs
- ConstructorArgumentAttribute.cs
- SystemDiagnosticsSection.cs
- EmissiveMaterial.cs
- ResourceManagerWrapper.cs
- TransactionManager.cs
- FontDriver.cs
- ListViewPagedDataSource.cs
- CodeTypeMemberCollection.cs
- oledbconnectionstring.cs
- ControlIdConverter.cs
- DrawListViewSubItemEventArgs.cs
- IDispatchConstantAttribute.cs
- XmlObjectSerializerWriteContext.cs
- MetadataPropertyAttribute.cs
- HyperLinkField.cs