Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / System / Windows / DependencyPropertyKey.cs / 1 / 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
- ListViewDeleteEventArgs.cs
- AspNetSynchronizationContext.cs
- DataConnectionHelper.cs
- DetailsViewModeEventArgs.cs
- PhysicalFontFamily.cs
- GridViewEditEventArgs.cs
- DesignTimeParseData.cs
- Perspective.cs
- VarInfo.cs
- PerformanceCounterPermissionEntryCollection.cs
- ConfigurationStrings.cs
- DeclaredTypeValidator.cs
- ClientTarget.cs
- _HeaderInfoTable.cs
- GPPOINTF.cs
- WebBrowserNavigatedEventHandler.cs
- ContextMenuStrip.cs
- SecurityRuntime.cs
- XmlValidatingReaderImpl.cs
- ResizeGrip.cs
- InheritedPropertyDescriptor.cs
- PreDigestedSignedInfo.cs
- CheckBoxAutomationPeer.cs
- XmlSchemas.cs
- HttpListenerException.cs
- PageParserFilter.cs
- NotifyParentPropertyAttribute.cs
- UIElementHelper.cs
- SQLInt64.cs
- Cursors.cs
- TableRow.cs
- XmlSchemaObjectTable.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- sqlstateclientmanager.cs
- DataRowCollection.cs
- AuthenticationSection.cs
- DetailsViewDeletedEventArgs.cs
- XmlName.cs
- RSAOAEPKeyExchangeDeformatter.cs
- AssociationSetMetadata.cs
- SafeFileHandle.cs
- TextEndOfSegment.cs
- XmlHierarchicalDataSourceView.cs
- Panel.cs
- FixedDocumentSequencePaginator.cs
- GridSplitter.cs
- EventTrigger.cs
- MessageRpc.cs
- BrowserDefinition.cs
- ConfigurationManagerInternalFactory.cs
- LinkDescriptor.cs
- CustomAttributeBuilder.cs
- PermissionRequestEvidence.cs
- ScrollItemProviderWrapper.cs
- ValidationHelper.cs
- MatrixCamera.cs
- RoleService.cs
- StructuredTypeInfo.cs
- FixedDSBuilder.cs
- ContentValidator.cs
- SqlSelectStatement.cs
- MasterPageParser.cs
- DataTemplateKey.cs
- DataBindingHandlerAttribute.cs
- DataGridViewCellStateChangedEventArgs.cs
- LocalizeDesigner.cs
- XmlSchemaAttribute.cs
- WebConfigManager.cs
- XmlNullResolver.cs
- DataServiceQueryOfT.cs
- WaitHandleCannotBeOpenedException.cs
- ErrorWebPart.cs
- DiscoveryInnerClientAdhoc11.cs
- FillBehavior.cs
- TemplateBuilder.cs
- PeerApplicationLaunchInfo.cs
- CategoryEditor.cs
- WebUtil.cs
- SerialStream.cs
- GroupLabel.cs
- AspCompat.cs
- ButtonChrome.cs
- GridItemCollection.cs
- TraceContext.cs
- TextDecorations.cs
- ControlAdapter.cs
- FixedSOMFixedBlock.cs
- BidOverLoads.cs
- RC2CryptoServiceProvider.cs
- IndentedTextWriter.cs
- DiscreteKeyFrames.cs
- SectionRecord.cs
- CacheOutputQuery.cs
- _UriTypeConverter.cs
- ConstNode.cs
- XmlSignificantWhitespace.cs
- ClassicBorderDecorator.cs
- ITextView.cs
- InkCanvasAutomationPeer.cs
- Bitmap.cs