Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / MS / Internal / InheritanceContextHelper.cs / 1 / InheritanceContextHelper.cs
/****************************************************************************\ * * File: InheritanceContextHelper.cs * * This file holds a helper class for DO subclasses that implement an * inheritance context. * * Copyright (C) by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System; using System.Windows; using MS.Internal.WindowsBase; namespace MS.Internal { internal static class InheritanceContextHelper { //------------------------------------------------------------------- // // ProvideContextForObject // // Tell a DO that it has a new inheritance context available. // //------------------------------------------------------------------- [FriendAccessAllowed] // Built into Core, also used by Framework. internal static void ProvideContextForObject( DependencyObject context, DependencyObject newValue ) { if (context != null) { context.ProvideSelfAsInheritanceContext(newValue, null); } } //------------------------------------------------------------------- // // RemoveContextFromObject // // Tell a DO that it has lost its inheritance context. // //-------------------------------------------------------------------- [FriendAccessAllowed] // Built into Base, also used by Framework. internal static void RemoveContextFromObject( DependencyObject context, DependencyObject oldValue ) { if (context != null && oldValue.InheritanceContext == context) { context.RemoveSelfAsInheritanceContext(oldValue, null); } } //------------------------------------------------------------------- // // AddInheritanceContext // // Implementation to receive a new inheritance context // //-------------------------------------------------------------------- [FriendAccessAllowed] // Built into Base, also used by Framework. internal static void AddInheritanceContext(DependencyObject newInheritanceContext, DependencyObject value, ref bool hasMultipleInheritanceContexts, ref DependencyObject inheritanceContext ) { // ignore the request when the new context is the same as the old, // or when there are already multiple contexts if (newInheritanceContext != inheritanceContext && !hasMultipleInheritanceContexts) { if (inheritanceContext == null || newInheritanceContext == null) { // Pick up the new context inheritanceContext = newInheritanceContext; } else { // We are now being referenced from multiple // places, clear the context hasMultipleInheritanceContexts = true; inheritanceContext = null; } value.OnInheritanceContextChanged(EventArgs.Empty); } } //-------------------------------------------------------------------- // // RemoveInheritanceContext // // Implementation to remove an old inheritance context // //------------------------------------------------------------------- [FriendAccessAllowed] // Built into Base, also used by Framework. internal static void RemoveInheritanceContext(DependencyObject oldInheritanceContext, DependencyObject value, ref bool hasMultipleInheritanceContexts, ref DependencyObject inheritanceContext ) { // ignore the request when the given context doesn't match the old one, // or when there are already multiple contexts if (oldInheritanceContext == inheritanceContext && !hasMultipleInheritanceContexts) { // clear the context inheritanceContext = null; value.OnInheritanceContextChanged(EventArgs.Empty); } } } } // 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
- NonParentingControl.cs
- DirectoryGroupQuery.cs
- CookieProtection.cs
- LayoutSettings.cs
- Message.cs
- DataBindingList.cs
- XsdBuildProvider.cs
- SerializationEventsCache.cs
- ResourceExpressionBuilder.cs
- Filter.cs
- InternalBufferOverflowException.cs
- DesignerActionList.cs
- RequestCacheManager.cs
- DataBoundControlAdapter.cs
- FastPropertyAccessor.cs
- OutgoingWebRequestContext.cs
- TaskFactory.cs
- XmlSchemaAny.cs
- Image.cs
- AdjustableArrowCap.cs
- ResourcesChangeInfo.cs
- XLinq.cs
- SocketAddress.cs
- cookie.cs
- Stacktrace.cs
- updatecommandorderer.cs
- DropShadowBitmapEffect.cs
- MenuItemCollection.cs
- HitTestFilterBehavior.cs
- AsymmetricSignatureDeformatter.cs
- QueryNode.cs
- RightNameExpirationInfoPair.cs
- Size3DConverter.cs
- DesignerHost.cs
- NativeObjectSecurity.cs
- DataGridTablesFactory.cs
- InternalTypeHelper.cs
- CodeDOMUtility.cs
- PositiveTimeSpanValidator.cs
- GeneralTransform3DCollection.cs
- DocumentGridContextMenu.cs
- _BasicClient.cs
- TraceLog.cs
- DataGridViewCellCollection.cs
- EntityReference.cs
- CombinedGeometry.cs
- AdPostCacheSubstitution.cs
- StoreContentChangedEventArgs.cs
- SmtpCommands.cs
- Int32RectValueSerializer.cs
- UnionCodeGroup.cs
- ListParaClient.cs
- MdiWindowListItemConverter.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- WebReferencesBuildProvider.cs
- BitmapEffectInput.cs
- graph.cs
- Parameter.cs
- CompletedAsyncResult.cs
- TemplateBindingExpressionConverter.cs
- WindowsSecurityToken.cs
- SystemColors.cs
- NetStream.cs
- UriExt.cs
- ContentDisposition.cs
- KeyboardDevice.cs
- ProxyWebPart.cs
- ObjectAssociationEndMapping.cs
- MD5HashHelper.cs
- TreeViewItem.cs
- Pool.cs
- TableCell.cs
- TaiwanLunisolarCalendar.cs
- TextViewBase.cs
- ServiceModelStringsVersion1.cs
- InplaceBitmapMetadataWriter.cs
- ListViewGroupItemCollection.cs
- HttpApplicationStateBase.cs
- GeometryHitTestParameters.cs
- Win32Exception.cs
- QueryOperationResponseOfT.cs
- ToolStripHighContrastRenderer.cs
- StreamGeometry.cs
- ValidationErrorEventArgs.cs
- Geometry.cs
- ProjectionCamera.cs
- RoutedUICommand.cs
- DataGridColumnEventArgs.cs
- HtmlToClrEventProxy.cs
- InitializeCorrelation.cs
- AttributeData.cs
- BitmapEffectInputConnector.cs
- TraceSwitch.cs
- IisTraceWebEventProvider.cs
- ObjectDataSourceFilteringEventArgs.cs
- COM2IProvidePropertyBuilderHandler.cs
- PriorityBindingExpression.cs
- ContractComponent.cs
- TextParentUndoUnit.cs
- XPathNavigator.cs