Browse Source
* Fix #20625: fix compiled binding DataContext inference in ItemTemplate The Sandbox repro failed with AVLN2100/AVLN2000 when compiled bindings were used with ItemTemplate and name-based DataContext access. Root causes: - No fallback DataContext type was inferred for the root object when x:DataType was absent. - Name-scope lookup could capture stale DataContext metadata from an unrelated traversal branch, causing #ListBoxRoot.DataContext to incorrectly resolve to the item type. Fixes: - Add root-level DataContext fallback inference in AvaloniaXamlIlDataContextTypeTransformer. - Update ScopeRegistrationFinder to resolve DataContext from the current ancestor stack when the matching name is found. - Preserve first-match semantics and prefer root namescope lookup before deferred scopes in name binding resolution. - Add and expand unit tests for ItemTemplate and nested namescope scenarios, including mismatched runtime DataContext behavior. Signed-off-by: João Cruz <joaosantaremdacruz@tecnico.ulisboa.pt> * Fix #20625: simplify compiled binding regression tests Address review feedback to reduce test complexity in XamlIlTests. This change removes per-test UserControl helper classes and command scaffolding that were not required to validate the compiler behavior. Tests now use inline XAML in each [Fact] and shared lightweight mock types for root and item data. The compiled binding scenarios are still covered, including root fallback inference and named DataContext resolution with ItemTemplate and nested namescopes, but with less boilerplate and better readability. * Fix #20625: remove automatic DataContext fallback to root type Address review feedback by removing the automatic fallback inference to the root type in AvaloniaXamlIlDataContextTypeTransformer, as it is not necessary to fix the issue and is not desired behavior. Also removes the unit tests that validated this specific fallback. --------- Signed-off-by: João Cruz <joaosantaremdacruz@tecnico.ulisboa.pt> Co-authored-by: Julien Lebosquain <julien@lebosquain.net>pull/21371/head
committed by
GitHub
2 changed files with 75 additions and 12 deletions
Loading…
Reference in new issue