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
- XmlDownloadManager.cs
- OleDbConnectionFactory.cs
- XmlDataSourceView.cs
- DLinqDataModelProvider.cs
- ValidatingReaderNodeData.cs
- ApplyImportsAction.cs
- Int16AnimationBase.cs
- InternalBufferOverflowException.cs
- ThreadStartException.cs
- MarshalDirectiveException.cs
- ConfigurationSettings.cs
- PerformanceCounters.cs
- SignedXml.cs
- Merger.cs
- SessionStateUtil.cs
- AdministrationHelpers.cs
- TextBoxBase.cs
- FileLoadException.cs
- DataGridViewColumnEventArgs.cs
- BamlLocalizationDictionary.cs
- SizeFConverter.cs
- SapiRecoContext.cs
- EmbossBitmapEffect.cs
- AutoSizeComboBox.cs
- TypeResolver.cs
- UnmanagedMemoryStream.cs
- TextElementEnumerator.cs
- QilCloneVisitor.cs
- NameValueSectionHandler.cs
- Compiler.cs
- TraceInternal.cs
- BadImageFormatException.cs
- FilteredAttributeCollection.cs
- ToolStripArrowRenderEventArgs.cs
- Rijndael.cs
- CreateUserErrorEventArgs.cs
- BitmapDownload.cs
- RowsCopiedEventArgs.cs
- StringValueSerializer.cs
- ObjectDataSourceSelectingEventArgs.cs
- IisTraceListener.cs
- Directory.cs
- GPRECT.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- TextParagraphCache.cs
- WebPartAddingEventArgs.cs
- WebPartDisplayModeEventArgs.cs
- TableLayoutPanelCellPosition.cs
- CryptoHandle.cs
- AdornerPresentationContext.cs
- TableDetailsCollection.cs
- SystemFonts.cs
- DictionaryItemsCollection.cs
- TextRunProperties.cs
- EntityTypeEmitter.cs
- SafeHandles.cs
- ExpressionCopier.cs
- WebPartTracker.cs
- SHA512Cng.cs
- WhitespaceSignificantCollectionAttribute.cs
- IUnknownConstantAttribute.cs
- ProfileModule.cs
- ScriptRef.cs
- oledbmetadatacollectionnames.cs
- AnnotationMap.cs
- ResourceExpression.cs
- OperationValidationEventArgs.cs
- CqlWriter.cs
- AppLevelCompilationSectionCache.cs
- InternalTypeHelper.cs
- TemplateInstanceAttribute.cs
- ErrorFormatterPage.cs
- LogLogRecordHeader.cs
- OrCondition.cs
- EdmFunction.cs
- LambdaCompiler.cs
- Enum.cs
- CompilerErrorCollection.cs
- ParameterToken.cs
- WebHeaderCollection.cs
- DispatchWrapper.cs
- CodePageUtils.cs
- BaseProcessor.cs
- TypeListConverter.cs
- DocumentPaginator.cs
- NativeRecognizer.cs
- IssuedTokenClientBehaviorsElement.cs
- SystemInfo.cs
- PublisherIdentityPermission.cs
- ProgressBarHighlightConverter.cs
- CheckBoxField.cs
- SettingsBase.cs
- VerticalAlignConverter.cs
- COM2ColorConverter.cs
- NotImplementedException.cs
- SettingsPropertyCollection.cs
- ComboBox.cs
- UrlAuthFailedErrorFormatter.cs
- Operand.cs
- SerialPinChanges.cs