Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- Directory.cs
- ContainerControl.cs
- ProcessHostServerConfig.cs
- CollectionBase.cs
- OpenFileDialog.cs
- CreateUserWizard.cs
- KeySpline.cs
- DataStorage.cs
- ListViewDeletedEventArgs.cs
- ReservationCollection.cs
- RequestQueue.cs
- CryptoApi.cs
- SpellerError.cs
- TimeSpanValidator.cs
- EntityDataSourceColumn.cs
- XmlWriterSettings.cs
- ClientRuntimeConfig.cs
- OAVariantLib.cs
- ISAPIApplicationHost.cs
- MimeParameter.cs
- XDRSchema.cs
- DbConnectionClosed.cs
- __Filters.cs
- DbConnectionClosed.cs
- FrameworkContentElementAutomationPeer.cs
- IntegerValidator.cs
- ConsoleCancelEventArgs.cs
- DetailsViewInsertedEventArgs.cs
- DeploymentSection.cs
- FunctionParameter.cs
- InteropAutomationProvider.cs
- BinarySecretKeyIdentifierClause.cs
- IdleTimeoutMonitor.cs
- Types.cs
- UriTemplatePathSegment.cs
- NestedContainer.cs
- FixedPageAutomationPeer.cs
- shaperfactoryquerycacheentry.cs
- WizardPanel.cs
- EntitySetBaseCollection.cs
- TypeLoadException.cs
- StatusStrip.cs
- ReachPrintTicketSerializerAsync.cs
- HierarchicalDataBoundControlAdapter.cs
- DebugHandleTracker.cs
- Duration.cs
- CheckBoxAutomationPeer.cs
- TextTreeTextBlock.cs
- DynamicDataRoute.cs
- DebuggerAttributes.cs
- ProcessModelSection.cs
- UITypeEditors.cs
- PresentationTraceSources.cs
- AudioFormatConverter.cs
- ResourceDictionary.cs
- TaskFormBase.cs
- SafeNativeMethods.cs
- Page.cs
- CaseInsensitiveComparer.cs
- OracleConnection.cs
- DataServiceExpressionVisitor.cs
- SplitterPanelDesigner.cs
- DataGridTablesFactory.cs
- EncoderFallback.cs
- UTF7Encoding.cs
- BufferedReadStream.cs
- Int16Storage.cs
- TemplateParser.cs
- XmlWriterTraceListener.cs
- EntitySqlException.cs
- ZoneIdentityPermission.cs
- ValidatorAttribute.cs
- HScrollBar.cs
- XslException.cs
- TerminateDesigner.cs
- CookieProtection.cs
- DbConnectionPoolCounters.cs
- DataBoundControlDesigner.cs
- URLIdentityPermission.cs
- AutoResizedEvent.cs
- SqlDependency.cs
- CapabilitiesRule.cs
- CollectionViewGroup.cs
- PropertySegmentSerializationProvider.cs
- ResetableIterator.cs
- RegexGroup.cs
- EntityConnectionStringBuilder.cs
- ICollection.cs
- WorkflowRuntimeServiceElement.cs
- CompositeFontFamily.cs
- DataContractSerializerSection.cs
- View.cs
- UInt32.cs
- WizardStepBase.cs
- PrintDialog.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- WebPartCollection.cs
- ExtensionQuery.cs
- Permission.cs
- DataGridViewTextBoxEditingControl.cs