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
- SmtpFailedRecipientsException.cs
- DynamicRenderer.cs
- PointConverter.cs
- HttpListenerRequest.cs
- ActivityContext.cs
- IResourceProvider.cs
- ExpandedWrapper.cs
- StyleCollection.cs
- ApplicationFileParser.cs
- ColumnHeader.cs
- WriterOutput.cs
- HtmlInputImage.cs
- InvalidPrinterException.cs
- XmlWriter.cs
- TreeViewHitTestInfo.cs
- XmlSerializationGeneratedCode.cs
- SmiEventSink_Default.cs
- HyperLinkStyle.cs
- PropertyValueChangedEvent.cs
- MethodToken.cs
- SerialReceived.cs
- MarkupCompiler.cs
- TextDecorationCollection.cs
- EditorAttribute.cs
- JsonSerializer.cs
- CryptoHandle.cs
- LinqTreeNodeEvaluator.cs
- SiteOfOriginPart.cs
- Int32.cs
- ServiceBuildProvider.cs
- HitTestParameters.cs
- HelpInfo.cs
- SiteMapDataSourceView.cs
- CopyNodeSetAction.cs
- ClientConfigPaths.cs
- SigningCredentials.cs
- HtmlInputText.cs
- LinkArea.cs
- Highlights.cs
- HelpHtmlBuilder.cs
- SQLUtility.cs
- SqlLiftIndependentRowExpressions.cs
- EntityReference.cs
- DrawingServices.cs
- ObjectSet.cs
- NamespaceCollection.cs
- TargetParameterCountException.cs
- SequenceFullException.cs
- SessionStateContainer.cs
- CodeDirectionExpression.cs
- DbMetaDataColumnNames.cs
- CryptoApi.cs
- DataQuery.cs
- BamlWriter.cs
- ProfileGroupSettings.cs
- TcpClientSocketManager.cs
- Expr.cs
- LoginCancelEventArgs.cs
- OutputCacheSection.cs
- ProxyFragment.cs
- XmlElement.cs
- DocumentPage.cs
- ValueProviderWrapper.cs
- XmlUrlResolver.cs
- ListControl.cs
- WhiteSpaceTrimStringConverter.cs
- PriorityBinding.cs
- HotSpot.cs
- ThreadSafeList.cs
- RenderData.cs
- webbrowsersite.cs
- ReverseInheritProperty.cs
- ImageMetadata.cs
- DecoderNLS.cs
- EntityDataSourceWrapperCollection.cs
- XamlWriter.cs
- DataBoundControlAdapter.cs
- FormViewPagerRow.cs
- WindowsAuthenticationEventArgs.cs
- AQNBuilder.cs
- PaperSize.cs
- WebPartDisplayModeCancelEventArgs.cs
- ResourceProperty.cs
- _OSSOCK.cs
- HtmlButton.cs
- OleDbParameterCollection.cs
- ProtocolsConfiguration.cs
- SqlConnectionHelper.cs
- DataGridState.cs
- DataServiceClientException.cs
- PerformanceCounterManager.cs
- ChannelManagerBase.cs
- XmlnsDefinitionAttribute.cs
- FontFamily.cs
- PointCollectionValueSerializer.cs
- ToolboxSnapDragDropEventArgs.cs
- TableCell.cs
- StatusBarItemAutomationPeer.cs
- PlainXmlDeserializer.cs
- Canvas.cs