Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / System / Windows / DependencyPropertyKey.cs / 1305600 / DependencyPropertyKey.cs
using System; using System.Diagnostics; // For Assert namespace System.Windows { ////// Authorization key for access to read-only DependencyProperty. /// Acquired via DependencyProperty.RegisterReadOnly/RegisterAttachedReadOnly /// and used in DependencyObject.SetValue/ClearValue. /// ////// This object can have a transient state upon creation where the _dp /// field can be null until initialized. However in use _dp needs to always /// be non-null. Otherwise it is treated as a key that can't unlock anything. /// (When needed, this property is available via the static constant NoAccess. /// public sealed class DependencyPropertyKey { ////// The DependencyProperty associated with this access key. This key /// does not authorize access to any other property. /// public DependencyProperty DependencyProperty { get { return _dp; } } internal DependencyPropertyKey(DependencyProperty dp) { _dp = dp; } ////// Override the metadata of a property that is already secured with /// this key. /// public void OverrideMetadata( Type forType, PropertyMetadata typeMetadata ) { if( _dp == null ) { throw new InvalidOperationException(); } _dp.OverrideMetadata( forType, typeMetadata, this ); } // This is not a property setter because we can't have a public // property getter and a internal property setter on the same property. internal void SetDependencyProperty(DependencyProperty dp) { Debug.Assert(_dp==null,"This should only be used when we need a placeholder and have a temporary value of null. It should not be used to change this property."); _dp = dp; } private DependencyProperty _dp = null; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Diagnostics; // For Assert namespace System.Windows { ////// Authorization key for access to read-only DependencyProperty. /// Acquired via DependencyProperty.RegisterReadOnly/RegisterAttachedReadOnly /// and used in DependencyObject.SetValue/ClearValue. /// ////// This object can have a transient state upon creation where the _dp /// field can be null until initialized. However in use _dp needs to always /// be non-null. Otherwise it is treated as a key that can't unlock anything. /// (When needed, this property is available via the static constant NoAccess. /// public sealed class DependencyPropertyKey { ////// The DependencyProperty associated with this access key. This key /// does not authorize access to any other property. /// public DependencyProperty DependencyProperty { get { return _dp; } } internal DependencyPropertyKey(DependencyProperty dp) { _dp = dp; } ////// Override the metadata of a property that is already secured with /// this key. /// public void OverrideMetadata( Type forType, PropertyMetadata typeMetadata ) { if( _dp == null ) { throw new InvalidOperationException(); } _dp.OverrideMetadata( forType, typeMetadata, this ); } // This is not a property setter because we can't have a public // property getter and a internal property setter on the same property. internal void SetDependencyProperty(DependencyProperty dp) { Debug.Assert(_dp==null,"This should only be used when we need a placeholder and have a temporary value of null. It should not be used to change this property."); _dp = dp; } private DependencyProperty _dp = null; } } // 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
- EntityDataReader.cs
- InnerItemCollectionView.cs
- LicenseContext.cs
- ApplicationDirectoryMembershipCondition.cs
- GenericAuthenticationEventArgs.cs
- XmlNavigatorFilter.cs
- Transform.cs
- PathFigureCollection.cs
- AsyncOperation.cs
- HttpDebugHandler.cs
- StringComparer.cs
- GuidTagList.cs
- DataSourceControl.cs
- StackBuilderSink.cs
- LogAppendAsyncResult.cs
- TextTreeRootNode.cs
- XMLSyntaxException.cs
- MasterPage.cs
- ConnectionStringsExpressionBuilder.cs
- ExpressionNode.cs
- WpfSharedXamlSchemaContext.cs
- Calendar.cs
- IconBitmapDecoder.cs
- SqlGatherConsumedAliases.cs
- KeyedCollection.cs
- Size3DValueSerializer.cs
- ApplicationSecurityManager.cs
- ActiveDocumentEvent.cs
- _FixedSizeReader.cs
- AddInBase.cs
- XmlNodeComparer.cs
- NullableLongMinMaxAggregationOperator.cs
- QilValidationVisitor.cs
- EventTrigger.cs
- Color.cs
- VariableQuery.cs
- SortKey.cs
- StylusPointProperties.cs
- XmlDataCollection.cs
- DataGridViewColumnConverter.cs
- TrustLevel.cs
- SchemaEntity.cs
- PassportAuthenticationModule.cs
- DependencyPropertyAttribute.cs
- Stack.cs
- AccessibleObject.cs
- _SSPISessionCache.cs
- LineVisual.cs
- WriteTimeStream.cs
- UnmanagedMemoryStream.cs
- ListControlDesigner.cs
- MemberRelationshipService.cs
- WebBrowserEvent.cs
- DropDownList.cs
- StorageFunctionMapping.cs
- ThreadStateException.cs
- EndCreateSecurityTokenRequest.cs
- SqlAggregateChecker.cs
- RightsManagementPermission.cs
- TextDecorationCollection.cs
- XhtmlBasicPhoneCallAdapter.cs
- SettingsBase.cs
- URLIdentityPermission.cs
- LocatorGroup.cs
- ECDiffieHellman.cs
- XmlMapping.cs
- PackageFilter.cs
- odbcmetadatacolumnnames.cs
- ContainsSearchOperator.cs
- SqlInternalConnectionSmi.cs
- DateTimeStorage.cs
- _AutoWebProxyScriptWrapper.cs
- SqlConnectionHelper.cs
- GenericUriParser.cs
- XmlEnumAttribute.cs
- UriParserTemplates.cs
- TabControlAutomationPeer.cs
- odbcmetadatacolumnnames.cs
- TextBoxAutoCompleteSourceConverter.cs
- ContentIterators.cs
- StringWriter.cs
- SqlRowUpdatedEvent.cs
- CultureInfo.cs
- WmpBitmapDecoder.cs
- IgnorePropertiesAttribute.cs
- TemplateDefinition.cs
- ShapingWorkspace.cs
- Crc32.cs
- SessionStateContainer.cs
- LinearKeyFrames.cs
- Method.cs
- OdbcConnectionStringbuilder.cs
- SoapSchemaExporter.cs
- DataGridItem.cs
- MethodExpression.cs
- NameValueFileSectionHandler.cs
- EmptyEnumerable.cs
- DoubleSumAggregationOperator.cs
- XmlWriter.cs
- BooleanConverter.cs