Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / MS / Internal / ComponentModel / PropertyChangeTracker.cs / 1 / 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
- CleanUpVirtualizedItemEventArgs.cs
- RegexRunner.cs
- UnlockInstanceCommand.cs
- UrlRoutingModule.cs
- MemberCollection.cs
- NavigationWindowAutomationPeer.cs
- FormViewRow.cs
- HandleRef.cs
- ClientScriptManagerWrapper.cs
- ZoomPercentageConverter.cs
- PackageProperties.cs
- SmiEventSink.cs
- MultiPageTextView.cs
- XhtmlBasicObjectListAdapter.cs
- TokenBasedSet.cs
- TextContainerChangedEventArgs.cs
- Scripts.cs
- MemberInfoSerializationHolder.cs
- DiagnosticTraceSchemas.cs
- WindowsFormsHost.cs
- Int32Converter.cs
- CodeSnippetTypeMember.cs
- ProfileService.cs
- InternalBufferOverflowException.cs
- MsmqIntegrationBindingCollectionElement.cs
- SiteMap.cs
- BatchStream.cs
- DesignerDataStoredProcedure.cs
- BufferedGraphics.cs
- HandlerBase.cs
- DSASignatureDeformatter.cs
- SqlConnectionString.cs
- SqlRowUpdatingEvent.cs
- MetadataItemEmitter.cs
- SafeNativeMemoryHandle.cs
- MouseGestureValueSerializer.cs
- SQLGuidStorage.cs
- WebBaseEventKeyComparer.cs
- COM2PictureConverter.cs
- XMLUtil.cs
- PathGradientBrush.cs
- PropertyPanel.cs
- Vector3D.cs
- XmlChoiceIdentifierAttribute.cs
- XmlCustomFormatter.cs
- WindowsBrush.cs
- XmlAggregates.cs
- COM2PictureConverter.cs
- IntermediatePolicyValidator.cs
- MenuStrip.cs
- VScrollBar.cs
- HttpConfigurationSystem.cs
- ListViewGroupConverter.cs
- Update.cs
- ChangeInterceptorAttribute.cs
- OleDbError.cs
- LicenseProviderAttribute.cs
- ParsedAttributeCollection.cs
- XmlAttributeCollection.cs
- WindowsFormsHelpers.cs
- NoResizeHandleGlyph.cs
- FormParameter.cs
- DataBoundControl.cs
- VariableExpressionConverter.cs
- BaseServiceProvider.cs
- __Error.cs
- StatusBarItem.cs
- PerfCounters.cs
- GridViewPageEventArgs.cs
- DataBindingCollectionEditor.cs
- mediaeventshelper.cs
- RelativeSource.cs
- ConfigurationException.cs
- MaskDesignerDialog.cs
- VirtualDirectoryMapping.cs
- QilExpression.cs
- KerberosSecurityTokenProvider.cs
- CodeAttributeDeclarationCollection.cs
- LiteralControl.cs
- DrawListViewColumnHeaderEventArgs.cs
- UnaryQueryOperator.cs
- Unit.cs
- TraceSwitch.cs
- Asn1IntegerConverter.cs
- HttpRequestWrapper.cs
- DbDataAdapter.cs
- WindowsStatic.cs
- Math.cs
- PersonalizationEntry.cs
- ErrorFormatterPage.cs
- ArglessEventHandlerProxy.cs
- MenuEventArgs.cs
- HwndProxyElementProvider.cs
- ResetableIterator.cs
- DockPattern.cs
- QilGenerator.cs
- DataGridViewRowCollection.cs
- HttpPostedFileWrapper.cs
- FirewallWrapper.cs
- WebScriptServiceHostFactory.cs