Add IInterceptedRelatedManager opt-in seam to BindingContext/RelatedCurrencyManager#28
Draft
Copilot wants to merge 3 commits into
Draft
Add IInterceptedRelatedManager opt-in seam to BindingContext/RelatedCurrencyManager#28Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
…atedCurrencyManager - Add BindingContext.IInterceptedRelatedManager public nested interface with ParentHasRows, RaiseParentCurrentItemChanged, and BindToEmptyParentPlaceholder members - Add BindingContext.CreateInterceptedParentHandler protected virtual factory (returns null by default) - Add BindingContext.CreateRelatedCurrencyManager private helper; replace direct construction in EnsureListManager - Remove BindingContext.RewireRelatedCurrencyManagerParent (superseded by new design) - Add RelatedCurrencyManager second constructor accepting Func<RelatedCurrencyManager, EventHandler>? factory - Implement IInterceptedRelatedManager explicitly on RelatedCurrencyManager - Update WireParentManager/UnwireParentManager for intercepted handler path - Update Bind() to prime via intercepted handler when present (avoids constructor-time AddNew) - Remove RelatedCurrencyManager.RewireParentChangeHandler (superseded) - Update PublicAPI.Unshipped.txt for new/removed API surface - Add unit tests for default path and intercepted handler path
… reference, clarify empty-parent bypass
Copilot
AI
changed the title
[WIP] Add optional extension point to RelatedCurrencyManager
Add IInterceptedRelatedManager opt-in seam to BindingContext/RelatedCurrencyManager
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On .NET Framework,
ZBindingContextinterceptedBindingContextHashtable.Addto swap in a customCurrentChangedhandler before the child manager was primed — so the empty-parent EverettAddNew()/CancelCurrentEdit()branch was never reached. On .NET 10 the backing store is aDictionary, making that interception impossible. The previousRewireParentChangeHandlerapproach fired after construction, meaningParentManager_CurrentItemChanged(and thusAddNew()) already ran before any rewire could occur.This PR introduces a factory-based opt-in seam that installs a custom handler before the first prime, exactly replicating Framework ordering — with zero overhead on the default path.
BindingContext
BindingContext.IInterceptedRelatedManager— public nested interface (ParentHasRows,RaiseParentCurrentItemChanged,BindToEmptyParentPlaceholder) enabling a subclass in another assembly to drive the internalRelatedCurrencyManagerwithout reflection.protected virtual EventHandler? CreateInterceptedParentHandler(IInterceptedRelatedManager)— returnsnullby default; overriding activates the opt-in path.private CreateRelatedCurrencyManager(...)helper — factory delegate is only allocated whenGetType() != typeof(BindingContext), guaranteeing no overhead for stock WinForms.static RewireRelatedCurrencyManagerParent(...)(superseded).RelatedCurrencyManager
Func<RelatedCurrencyManager, EventHandler>?; the factory is invoked beforeBind()so_interceptedParentHandleris set before the first prime.Bind()gates on_interceptedParentHandler: default path callsParentManager_CurrentItemChangedas before; opt-in path calls the supplied handler (bypassing the EverettAddNew()branch).WireParentManager/UnwireParentManagersubscribe toCurrentChanged(notCurrentItemChanged) when a handler is active.BindingContext.IInterceptedRelatedManagerimplementation added.RewireParentChangeHandler()removed (superseded).Usage pattern
API surface
PublicAPI.Unshipped.txtupdated:RewireRelatedCurrencyManagerParentremoved;IInterceptedRelatedManagerinterface andCreateInterceptedParentHandlervirtual added.