Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- ModulesEntry.cs
- TypeReference.cs
- DataKey.cs
- VirtualDirectoryMappingCollection.cs
- TextTreeTextBlock.cs
- AutomationPropertyInfo.cs
- ProfileSettingsCollection.cs
- HttpResponseHeader.cs
- OdbcEnvironment.cs
- Transform3DCollection.cs
- CodeCompiler.cs
- SafeLibraryHandle.cs
- ThrowHelper.cs
- CodeGenerator.cs
- HtmlFormParameterWriter.cs
- HttpResponseHeader.cs
- FaultDescriptionCollection.cs
- XmlSchemaCollection.cs
- XPathPatternBuilder.cs
- ZipIOExtraFieldZip64Element.cs
- ResXFileRef.cs
- AppSecurityManager.cs
- AccessViolationException.cs
- HitTestDrawingContextWalker.cs
- SafeRightsManagementSessionHandle.cs
- SortQuery.cs
- KeyboardNavigation.cs
- EntityDesignerBuildProvider.cs
- ItemChangedEventArgs.cs
- EFAssociationProvider.cs
- SmiRecordBuffer.cs
- OpCopier.cs
- XomlCompiler.cs
- TranslateTransform3D.cs
- EventLogPermissionEntryCollection.cs
- Mouse.cs
- GrammarBuilderDictation.cs
- BooleanToVisibilityConverter.cs
- CollectionChangeEventArgs.cs
- ExecutionScope.cs
- CompressEmulationStream.cs
- updateconfighost.cs
- DoubleUtil.cs
- dbenumerator.cs
- LoginName.cs
- TracingConnectionInitiator.cs
- DocumentScope.cs
- AnimationStorage.cs
- ByteStreamBufferedMessageData.cs
- RSAPKCS1SignatureDeformatter.cs
- OdbcReferenceCollection.cs
- Primitive.cs
- OleAutBinder.cs
- UrlPath.cs
- Set.cs
- NumericUpDownAcceleration.cs
- NativeMethods.cs
- OutArgument.cs
- ObjectSet.cs
- Int32EqualityComparer.cs
- SqlConnectionManager.cs
- HandlerBase.cs
- ManagedWndProcTracker.cs
- Metadata.cs
- ConstraintEnumerator.cs
- Menu.cs
- PageAsyncTask.cs
- Processor.cs
- IPCCacheManager.cs
- KnownColorTable.cs
- Int16.cs
- ImageDrawing.cs
- PenCursorManager.cs
- SymbolEqualComparer.cs
- objectresult_tresulttype.cs
- MtomMessageEncodingBindingElement.cs
- SpeechSeg.cs
- Normalizer.cs
- NativeActivityFaultContext.cs
- ImpersonateTokenRef.cs
- HtmlTextBoxAdapter.cs
- CollectionTraceRecord.cs
- GenericsNotImplementedException.cs
- Zone.cs
- LocatorManager.cs
- LineGeometry.cs
- SolidBrush.cs
- Mappings.cs
- BrowsableAttribute.cs
- ProcessModelInfo.cs
- DataGridViewCellStyle.cs
- GlyphCollection.cs
- ResXResourceReader.cs
- PolicyException.cs
- TextRangeEdit.cs
- StorageMappingItemLoader.cs
- EmptyArray.cs
- ServiceHostingEnvironment.cs
- XhtmlTextWriter.cs
- MetadataUtilsSmi.cs