Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / System / Windows / DeferredReference.cs / 1 / DeferredReference.cs
//---------------------------------------------------------------------------- // // File: DeferredReference.cs // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: Proxy object passed to the property system to delay load values. // //--------------------------------------------------------------------------- namespace System.Windows { using MS.Internal.WindowsBase; // FriendAccessAllowed // Proxy object passed to the property system to delay load values. // // The property system will make a GetValue callback (dereferencing the // reference) inside DependencyProperty.GetValue calls, or before // coercion callbacks to derived classes. // // DeferredReference instances are passed directly to ValidateValue // callbacks (which always go to the DependencyProperty owner class), // and also to CoerceValue callbacks on the owner class only. THEREFORE, // IT IS [FriendAccessAllowed] // Built into Base, also used by Core & Framework. internal abstract class DeferredReference { //----------------------------------------------------- // // Internal Methods // //----------------------------------------------------- #region Internal Methods // Deferences a property value on demand. internal abstract object GetValue(BaseValueSourceInternal valueSource); // Gets the type of the value it represents internal abstract Type GetValueType(); #endregion Internal Methods } internal class DeferredMutableDefaultReference : DeferredReference { #region Constructor internal DeferredMutableDefaultReference(PropertyMetadata metadata, DependencyObject d, DependencyProperty dp) { _sourceObject = d; _sourceProperty = dp; _sourceMetadata = metadata; } #endregion Constructor #region Methods internal override object GetValue(BaseValueSourceInternal valueSource) { return _sourceMetadata.GetDefaultValue(_sourceObject, _sourceProperty); } // Gets the type of the value it represents internal override Type GetValueType() { return _sourceProperty.PropertyType; } #endregion Methods #region Properties internal PropertyMetadata SourceMetadata { get { return _sourceMetadata; } } protected DependencyObject SourceObject { get { return _sourceObject; } } protected DependencyProperty SourceProperty { get { return _sourceProperty; } } #endregion Properties #region Data private readonly PropertyMetadata _sourceMetadata; private readonly DependencyObject _sourceObject; private readonly DependencyProperty _sourceProperty; #endregion Data } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: DeferredReference.cs // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: Proxy object passed to the property system to delay load values. // //--------------------------------------------------------------------------- namespace System.Windows { using MS.Internal.WindowsBase; // FriendAccessAllowed // Proxy object passed to the property system to delay load values. // // The property system will make a GetValue callback (dereferencing the // reference) inside DependencyProperty.GetValue calls, or before // coercion callbacks to derived classes. // // DeferredReference instances are passed directly to ValidateValue // callbacks (which always go to the DependencyProperty owner class), // and also to CoerceValue callbacks on the owner class only. THEREFORE, // IT IS [FriendAccessAllowed] // Built into Base, also used by Core & Framework. internal abstract class DeferredReference { //----------------------------------------------------- // // Internal Methods // //----------------------------------------------------- #region Internal Methods // Deferences a property value on demand. internal abstract object GetValue(BaseValueSourceInternal valueSource); // Gets the type of the value it represents internal abstract Type GetValueType(); #endregion Internal Methods } internal class DeferredMutableDefaultReference : DeferredReference { #region Constructor internal DeferredMutableDefaultReference(PropertyMetadata metadata, DependencyObject d, DependencyProperty dp) { _sourceObject = d; _sourceProperty = dp; _sourceMetadata = metadata; } #endregion Constructor #region Methods internal override object GetValue(BaseValueSourceInternal valueSource) { return _sourceMetadata.GetDefaultValue(_sourceObject, _sourceProperty); } // Gets the type of the value it represents internal override Type GetValueType() { return _sourceProperty.PropertyType; } #endregion Methods #region Properties internal PropertyMetadata SourceMetadata { get { return _sourceMetadata; } } protected DependencyObject SourceObject { get { return _sourceObject; } } protected DependencyProperty SourceProperty { get { return _sourceProperty; } } #endregion Properties #region Data private readonly PropertyMetadata _sourceMetadata; private readonly DependencyObject _sourceObject; private readonly DependencyProperty _sourceProperty; #endregion Data } } // 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
- XmlUnspecifiedAttribute.cs
- UnknownBitmapDecoder.cs
- ReferencedType.cs
- NativeMethods.cs
- HGlobalSafeHandle.cs
- Slider.cs
- ToolStripButton.cs
- ConstraintCollection.cs
- SettingsContext.cs
- Span.cs
- BinaryOperationBinder.cs
- ToolStripTemplateNode.cs
- DataGridViewRowHeaderCell.cs
- WindowCollection.cs
- MsdtcClusterUtils.cs
- InstallerTypeAttribute.cs
- OdbcPermission.cs
- WebServiceTypeData.cs
- EntityCommandDefinition.cs
- HMACSHA256.cs
- DbDeleteCommandTree.cs
- InvalidWMPVersionException.cs
- FontWeight.cs
- ButtonBaseAdapter.cs
- ClientSponsor.cs
- AutomationFocusChangedEventArgs.cs
- CollectionsUtil.cs
- WindowsRebar.cs
- HttpWriter.cs
- RecognitionResult.cs
- DefaultValueTypeConverter.cs
- LicenseContext.cs
- DataTableMappingCollection.cs
- TabControl.cs
- RelatedEnd.cs
- ScriptingSectionGroup.cs
- _Rfc2616CacheValidators.cs
- TextRenderer.cs
- Utility.cs
- MSAAWinEventWrap.cs
- Util.cs
- InternalPolicyElement.cs
- CornerRadius.cs
- QilName.cs
- MgmtResManager.cs
- Rotation3DAnimation.cs
- ComplexLine.cs
- SelectionPatternIdentifiers.cs
- ParallelEnumerable.cs
- Maps.cs
- MatrixUtil.cs
- Accessible.cs
- ReflectPropertyDescriptor.cs
- ZipFileInfo.cs
- ResourceDescriptionAttribute.cs
- DbConnectionInternal.cs
- AndCondition.cs
- FixedPosition.cs
- ExtensibleClassFactory.cs
- AssemblyEvidenceFactory.cs
- ListViewItemSelectionChangedEvent.cs
- ConnectionConsumerAttribute.cs
- ConfigurationSettings.cs
- SchemaManager.cs
- XmlExpressionDumper.cs
- SamlSubject.cs
- IndicFontClient.cs
- DesignerVerbCollection.cs
- WindowPattern.cs
- LoginUtil.cs
- SocketPermission.cs
- BaseDataList.cs
- AttributedMetaModel.cs
- PrintEvent.cs
- DataGridTablesFactory.cs
- RuleSetDialog.Designer.cs
- XmlCompatibilityReader.cs
- Evidence.cs
- SqlBulkCopy.cs
- DataViewSetting.cs
- StandardBindingImporter.cs
- MemberHolder.cs
- MD5CryptoServiceProvider.cs
- Message.cs
- TreeViewImageKeyConverter.cs
- NameValueCollection.cs
- XamlToRtfWriter.cs
- BufferModeSettings.cs
- OleDbCommandBuilder.cs
- CopyAttributesAction.cs
- DateRangeEvent.cs
- CalendarSelectionChangedEventArgs.cs
- XamlInt32CollectionSerializer.cs
- ProcessHost.cs
- SqlUtil.cs
- IndexerNameAttribute.cs
- SourceElementsCollection.cs
- ComplexTypeEmitter.cs
- StorageEntitySetMapping.cs
- NodeLabelEditEvent.cs