Skip to content

fix: Give late VisualState setters the DataContext - #26260

Merged
ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/visualstate-setter-bindings
Nov 11, 2026
Merged

ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/visualstate-setter-bindings

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: closes unoplatform/uno.hotdesign#8404

PR Type:

🐞 Bugfix

What changed? 🚀

Since 7.0 a non-FrameworkElement DependencyObject has no DataContext of its own: it keeps the inherited one cached and forwards it to its children. That push happens once, so a child that registers after the DataContext arrived never got it.

VisualState setters hit this: they are built lazily, the first Setter gets the DataContext, but the second and later ones resolve {Binding} to null. In Hot Design this left ColumnDefinition.Width setters at *, which made the GridSplitter collapse the panels.

PropagateInheritedProperties(childStore) now also hands a newly registered child the cached DataContext of a non-FE store (it only covered properties in the property table). This mirrors WinUI, where CDependencyObjectCollection::ChildEnter raises an inheritance-context change so a late child's binding resolves its mentor.

  • Runtime test BindingTests.When_Binding_Setter_Values_In_VisualState (fails on master, passes with the fix).
  • Sample Visual states / VisualState_Setter_Bindings showing PASS/FAIL per setter (Opacity, TranslateTransform.X, ColumnDefinition.Width).
  • Validated locally on Skia desktop: BindingTests + Given_VisualStateManager all pass; Hot Design with a locally built Uno.UI.dll no longer collapses the panels.

PR Checklist ✅

🤖 Generated with Claude Code

A non-FrameworkElement store keeps its inherited DataContext outside
the property table, so a child registering after it arrived (the
second and later Setters of a lazily-built VisualState) never received
it and their {Binding} values resolved to null.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added the area/automation Categorizes an issue or PR as relevant to project automation label Nov 9, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 244903 found UI Test snapshots differences: skia-linux-screenshots: 208, skia-windows-screenshots: 259

Details
  • skia-linux-screenshots: 208 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Buttons.png-dark
    • Buttons.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AppWindowTitleBar Properties.png
    • Basics.png-dark
    • Basics.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AppWindowTitleBar Properties.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • AnimatedBackVisualSourceSamplePage.png
    • AutomationProperties_StructureAndProps.png-dark
    • AutomationProperties_StructureAndProps.png
  • skia-windows-screenshots: 259 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedVisualsTestbedPage.png
    • Basics.png-dark
    • Basics.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AutomationProperties_AutomationId.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • AutomationProperties_AutomationId.png-dark
    • Buttons.png-dark
    • Buttons.png
    • AnimatedVisualsTestbedPage.png-dark

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@Xiaoy312 Xiaoy312 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to sanity-check {Binding} on VSG setters
i remembered they were frown upon, but indeed winappsdk supports it

@ramezgerges
ramezgerges merged commit 1c30ab7 into unoplatform:master Nov 11, 2026
48 checks passed
@ramezgerges
ramezgerges deleted the dev/rara/visualstate-setter-bindings branch November 11, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants