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
- Types.cs
- ThreadStateException.cs
- InputProcessorProfiles.cs
- XmlSubtreeReader.cs
- TextCollapsingProperties.cs
- remotingproxy.cs
- TraceUtility.cs
- DataControlReference.cs
- FileDataSourceCache.cs
- BrowserCapabilitiesCompiler.cs
- SystemIPv4InterfaceProperties.cs
- XPathParser.cs
- Overlapped.cs
- Funcletizer.cs
- SequentialUshortCollection.cs
- ClientTargetSection.cs
- Int64AnimationBase.cs
- EditorBrowsableAttribute.cs
- ConnectionsZoneAutoFormat.cs
- SerializerDescriptor.cs
- KnowledgeBase.cs
- PolicyException.cs
- InkCanvas.cs
- FileUtil.cs
- CollectionChangeEventArgs.cs
- WriteFileContext.cs
- PackageStore.cs
- WsiProfilesElementCollection.cs
- SelectionListComponentEditor.cs
- WinInetCache.cs
- LongSumAggregationOperator.cs
- TemplatePropertyEntry.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- PersonalizationStateQuery.cs
- DrawingAttributesDefaultValueFactory.cs
- RectangleGeometry.cs
- GridViewUpdatedEventArgs.cs
- DbParameterCollectionHelper.cs
- DetailsView.cs
- CategoryValueConverter.cs
- WindowsIdentity.cs
- TextStore.cs
- DirectoryNotFoundException.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- GeneralTransform3D.cs
- SerializerDescriptor.cs
- PropertyMapper.cs
- IdleTimeoutMonitor.cs
- WebPartTransformer.cs
- MultiView.cs
- CodeTypeReferenceExpression.cs
- XmlArrayItemAttributes.cs
- RootAction.cs
- SourceExpressionException.cs
- Grid.cs
- WindowsRegion.cs
- GroupAggregateExpr.cs
- ResourceDictionary.cs
- CompensatableTransactionScopeActivityDesigner.cs
- TraceLevelHelper.cs
- OptimizedTemplateContentHelper.cs
- BulletedListEventArgs.cs
- ServiceModelConfiguration.cs
- Label.cs
- DateTimePicker.cs
- XmlSubtreeReader.cs
- ReadOnlyMetadataCollection.cs
- Region.cs
- Attributes.cs
- OperationDescription.cs
- DataColumnCollection.cs
- DateTimeParse.cs
- DataRelationCollection.cs
- PolyLineSegment.cs
- EdmSchemaError.cs
- DataViewListener.cs
- BindingList.cs
- AnnotationStore.cs
- XmlSchemaObjectTable.cs
- MsmqIntegrationSecurityMode.cs
- MimeMultiPart.cs
- EntityDataSourceContextCreatedEventArgs.cs
- MenuScrollingVisibilityConverter.cs
- ConnectionStringSettings.cs
- EntityDataSourceSelectedEventArgs.cs
- Parameter.cs
- TypeSemantics.cs
- dataobject.cs
- complextypematerializer.cs
- SchemaContext.cs
- MatrixTransform.cs
- DictionaryContent.cs
- InstanceKeyNotReadyException.cs
- DBDataPermissionAttribute.cs
- DictionaryBase.cs
- StandardCommands.cs
- QilXmlReader.cs
- DomainUpDown.cs
- DataRelationPropertyDescriptor.cs
- TickBar.cs