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
- DBDataPermissionAttribute.cs
- ButtonFieldBase.cs
- FileLevelControlBuilderAttribute.cs
- AttributeQuery.cs
- ClientTargetCollection.cs
- SqlFormatter.cs
- IndexedString.cs
- HtmlSelect.cs
- StringDictionaryWithComparer.cs
- BitArray.cs
- GridViewRowEventArgs.cs
- codemethodreferenceexpression.cs
- DatagridviewDisplayedBandsData.cs
- CheckBoxAutomationPeer.cs
- ContentWrapperAttribute.cs
- ActivityInterfaces.cs
- CriticalHandle.cs
- TypeForwardedToAttribute.cs
- TextContainer.cs
- DetailsViewUpdateEventArgs.cs
- OptionalMessageQuery.cs
- PeerApplicationLaunchInfo.cs
- XmlQueryRuntime.cs
- _LazyAsyncResult.cs
- EditingCoordinator.cs
- xmlsaver.cs
- NumericUpDown.cs
- BehaviorEditorPart.cs
- DocumentGridPage.cs
- DesignerDataParameter.cs
- InvokePatternIdentifiers.cs
- MergePropertyDescriptor.cs
- HTTPNotFoundHandler.cs
- CompilationPass2TaskInternal.cs
- DesignDataSource.cs
- DecoratedNameAttribute.cs
- CompoundFileStorageReference.cs
- StickyNoteHelper.cs
- FlowLayoutPanel.cs
- TdsParserSafeHandles.cs
- SqlNotificationRequest.cs
- ILGen.cs
- CapabilitiesState.cs
- PolyQuadraticBezierSegment.cs
- WebConfigurationManager.cs
- UndoManager.cs
- XmlHelper.cs
- RegisterInfo.cs
- LambdaValue.cs
- BuildProviderAppliesToAttribute.cs
- DataChangedEventManager.cs
- DbgCompiler.cs
- ContainerSelectorGlyph.cs
- LookupNode.cs
- FormViewInsertEventArgs.cs
- PaginationProgressEventArgs.cs
- XmlSchemaRedefine.cs
- PropagatorResult.cs
- SingleObjectCollection.cs
- TextParagraphView.cs
- OleDbFactory.cs
- FormParameter.cs
- Int32KeyFrameCollection.cs
- MimeBasePart.cs
- ClaimComparer.cs
- COM2PropertyDescriptor.cs
- SqlDataReaderSmi.cs
- OleDbPermission.cs
- SQLMoney.cs
- ReceiveContextCollection.cs
- MenuItemStyleCollection.cs
- ProxyFragment.cs
- XmlSchemaObjectCollection.cs
- ViewEventArgs.cs
- RelatedImageListAttribute.cs
- XmlSchemaChoice.cs
- XmlCharType.cs
- DefaultProxySection.cs
- ScrollData.cs
- CodeTypeDeclaration.cs
- _RequestCacheProtocol.cs
- OdbcErrorCollection.cs
- MemberDomainMap.cs
- DateTimeFormatInfoScanner.cs
- DataRelationCollection.cs
- NameValueCollection.cs
- BinaryMethodMessage.cs
- PointAnimation.cs
- DictionaryItemsCollection.cs
- TableLayoutSettingsTypeConverter.cs
- CommandConverter.cs
- SecurityChannelFaultConverter.cs
- CacheHelper.cs
- ScriptingAuthenticationServiceSection.cs
- LinqDataSourceDeleteEventArgs.cs
- CellCreator.cs
- ImageSource.cs
- DESCryptoServiceProvider.cs
- brushes.cs
- WsrmFault.cs