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
- KnownBoxes.cs
- XmlSchemaSimpleType.cs
- TryLoadRunnableWorkflowCommand.cs
- Span.cs
- DataColumnMapping.cs
- AffineTransform3D.cs
- MimeMultiPart.cs
- sqlcontext.cs
- ScriptManager.cs
- ProfileModule.cs
- TouchFrameEventArgs.cs
- BackgroundWorker.cs
- NonDualMessageSecurityOverHttp.cs
- SiteMapDesignerDataSourceView.cs
- MetabaseServerConfig.cs
- XsltOutput.cs
- Zone.cs
- DependencyPropertyKey.cs
- CryptoStream.cs
- MD5CryptoServiceProvider.cs
- StreamGeometry.cs
- Boolean.cs
- EntityDataSourceView.cs
- HttpStreamMessage.cs
- ConfigurationValues.cs
- AssemblyAttributes.cs
- ListDictionary.cs
- ExpressionWriter.cs
- ConnectionPointCookie.cs
- SmiXetterAccessMap.cs
- HtmlWindowCollection.cs
- MatrixStack.cs
- GregorianCalendarHelper.cs
- FastPropertyAccessor.cs
- InfoCardKeyedHashAlgorithm.cs
- XmlSchemaDatatype.cs
- PolicyLevel.cs
- ProcessThreadDesigner.cs
- remotingproxy.cs
- Accessors.cs
- ExclusiveNamedPipeTransportManager.cs
- EllipseGeometry.cs
- CaseStatementSlot.cs
- ToolStripDropDownClosingEventArgs.cs
- MultiBinding.cs
- OdbcConnectionOpen.cs
- MobileUITypeEditor.cs
- MappingModelBuildProvider.cs
- XmlSequenceWriter.cs
- HyperlinkAutomationPeer.cs
- Mapping.cs
- TaskSchedulerException.cs
- PopupRootAutomationPeer.cs
- Calendar.cs
- sqlmetadatafactory.cs
- DataSourceListEditor.cs
- SmtpLoginAuthenticationModule.cs
- XmlHelper.cs
- CqlParser.cs
- AvTrace.cs
- SqlBulkCopy.cs
- safesecurityhelperavalon.cs
- MultiByteCodec.cs
- RotationValidation.cs
- COMException.cs
- ObfuscateAssemblyAttribute.cs
- XamlPointCollectionSerializer.cs
- AutomationAttributeInfo.cs
- TextReader.cs
- SystemNetHelpers.cs
- ItemMap.cs
- CodeEventReferenceExpression.cs
- DoubleIndependentAnimationStorage.cs
- PersistenceException.cs
- Window.cs
- GenericPrincipal.cs
- CommandLibraryHelper.cs
- SqlMetaData.cs
- OracleColumn.cs
- StickyNote.cs
- datacache.cs
- StoryFragments.cs
- Message.cs
- QuaternionAnimation.cs
- XmlHierarchicalDataSourceView.cs
- BrushValueSerializer.cs
- HtmlInputHidden.cs
- DoubleAnimationBase.cs
- AdapterDictionary.cs
- SystemInformation.cs
- FileDetails.cs
- MethodImplAttribute.cs
- CriticalHandle.cs
- DateRangeEvent.cs
- ChtmlCalendarAdapter.cs
- HttpProfileGroupBase.cs
- ContextBase.cs
- CodeMemberMethod.cs
- IconEditor.cs
- DataGridViewSelectedRowCollection.cs