-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[XSG] Optimize compiled bindings for RelativeSource with explicit Source #33249
Copy link
Copy link
Open
Labels
area-xamlXAML, CSS, Triggers, BehaviorsXAML, CSS, Triggers, Behaviorss/triagedIssue has been reviewedIssue has been reviewedxsgXaml sourceGenXaml sourceGen
Milestone
Description
Description
PR #33248 fixed a regression where bindings with RelativeSource and Path=. returned null. The fix skips the compiled binding path when a binding has a Source property with a RelativeSourceExtension, falling back to the string-based binding.
While this correctly fixes the bug, it disables binding source generation for these cases. We should revisit this to see if we can still generate optimized bindings while correctly handling the RelativeSource source resolution.
Current Behavior (after fix)
When a binding has:
CommandParameter="{Binding Path=., Source={RelativeSource AncestorType={x:Type MainPage}}}"The SourceGen now generates a regular Binding instead of a TypedBinding:
var bindingBase = new Binding(path, mode, converter, ..., source);Potential Optimization
Consider if we can still generate a TypedBinding that:
- Uses the
RelativeSourceresolved type as the source type (notx:DataType) - Correctly handles
Path=.to return the resolved ancestor itself
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-xamlXAML, CSS, Triggers, BehaviorsXAML, CSS, Triggers, Behaviorss/triagedIssue has been reviewedIssue has been reviewedxsgXaml sourceGenXaml sourceGen