Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / ComponentModel / PropertyChangeTracker.cs / 1305600 / PropertyChangeTracker.cs
namespace MS.Internal.ComponentModel
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Security.Permissions;
using System.Windows;
///
/// A change tracking expression that is used to raise property change events.
///
internal class PropertyChangeTracker : Expression
{
internal PropertyChangeTracker(DependencyObject obj, DependencyProperty property)
: base(ExpressionMode.NonSharable | ExpressionMode.ForwardsInvalidations)
{
Debug.Assert(obj != null && property != null);
_object = obj;
_property = property;
ChangeSources(_object, _property, new DependencySource[] { new DependencySource(obj, property) });
}
internal override void OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
{
DependencyProperty dp = args.Property;
if (_object == d && _property == dp && Changed != null)
{
Changed(_object, EventArgs.Empty);
}
}
internal void Close()
{
_object = null;
_property = null;
ChangeSources(null, null, null);
}
internal bool CanClose
{
get { return Changed == null; }
}
internal EventHandler Changed;
private DependencyObject _object;
private DependencyProperty _property;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace MS.Internal.ComponentModel
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Security.Permissions;
using System.Windows;
///
/// A change tracking expression that is used to raise property change events.
///
internal class PropertyChangeTracker : Expression
{
internal PropertyChangeTracker(DependencyObject obj, DependencyProperty property)
: base(ExpressionMode.NonSharable | ExpressionMode.ForwardsInvalidations)
{
Debug.Assert(obj != null && property != null);
_object = obj;
_property = property;
ChangeSources(_object, _property, new DependencySource[] { new DependencySource(obj, property) });
}
internal override void OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
{
DependencyProperty dp = args.Property;
if (_object == d && _property == dp && Changed != null)
{
Changed(_object, EventArgs.Empty);
}
}
internal void Close()
{
_object = null;
_property = null;
ChangeSources(null, null, null);
}
internal bool CanClose
{
get { return Changed == null; }
}
internal EventHandler Changed;
private DependencyObject _object;
private DependencyProperty _property;
}
}
// 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
- IntSecurity.cs
- EditableRegion.cs
- HostedHttpContext.cs
- X509UI.cs
- SmiContext.cs
- XslTransform.cs
- UnSafeCharBuffer.cs
- URLBuilder.cs
- HttpChannelBindingToken.cs
- QilChoice.cs
- SimpleApplicationHost.cs
- BufferedGraphics.cs
- DateTimeOffset.cs
- DataFieldEditor.cs
- ConvertersCollection.cs
- SqlStream.cs
- ObservableDictionary.cs
- DbTransaction.cs
- FtpWebRequest.cs
- LabelLiteral.cs
- PathGeometry.cs
- IgnoreFlushAndCloseStream.cs
- PreloadedPackages.cs
- X509RawDataKeyIdentifierClause.cs
- Site.cs
- EntityDataSourceValidationException.cs
- SuppressMessageAttribute.cs
- SchemaConstraints.cs
- TextWriterEngine.cs
- DataSourceView.cs
- TagPrefixInfo.cs
- ZipIOExtraFieldZip64Element.cs
- TextBlock.cs
- UnsafeNativeMethods.cs
- ACE.cs
- IsolatedStorageFileStream.cs
- PrintDocument.cs
- SEHException.cs
- PageVisual.cs
- SqlMetaData.cs
- XPathDocument.cs
- ellipse.cs
- UniformGrid.cs
- XmlIterators.cs
- ConfigXmlAttribute.cs
- TableRow.cs
- ExpressionBindingCollection.cs
- FilterableAttribute.cs
- WebPartMovingEventArgs.cs
- returneventsaver.cs
- GridViewSelectEventArgs.cs
- SqlDataSourceConfigureFilterForm.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- wgx_sdk_version.cs
- XmlWriterSettings.cs
- ToolBarTray.cs
- RSAPKCS1SignatureFormatter.cs
- UserNameSecurityToken.cs
- ImageBrush.cs
- WebDescriptionAttribute.cs
- MenuItemBinding.cs
- XmlImplementation.cs
- MenuItemBinding.cs
- SqlRecordBuffer.cs
- EventPrivateKey.cs
- TextStore.cs
- DigitShape.cs
- CodeStatement.cs
- IntegerFacetDescriptionElement.cs
- Menu.cs
- OlePropertyStructs.cs
- _NativeSSPI.cs
- _StreamFramer.cs
- DetailsViewInsertedEventArgs.cs
- PrincipalPermission.cs
- GridItemProviderWrapper.cs
- OSFeature.cs
- HtmlLink.cs
- ErrorTableItemStyle.cs
- NativeMethods.cs
- ListViewHitTestInfo.cs
- DuplicateWaitObjectException.cs
- grammarelement.cs
- RowBinding.cs
- DefaultProxySection.cs
- ServiceModelSecurityTokenRequirement.cs
- Geometry3D.cs
- JournalEntryStack.cs
- SqlConnectionHelper.cs
- PersistenceProviderElement.cs
- DataGridViewSortCompareEventArgs.cs
- SslSecurityTokenParameters.cs
- TimeZoneNotFoundException.cs
- FileAuthorizationModule.cs
- ConsumerConnectionPointCollection.cs
- WebControl.cs
- PersonalizationDictionary.cs
- ByteStorage.cs
- WindowsAuthenticationEventArgs.cs
- ToolStripItemDesigner.cs