Repository navigation
Dev/ramez/bc38 background to control - #23573
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns Uno’s Background API surface with WinUI by removing the FrameworkElement-level Background and re-declaring it on the WinUI “background painter” types (e.g., Control, Panel, Border, ContentPresenter, ItemsRepeater, ScrollPresenter), with accompanying consumer updates, tests, and spec documentation.
Changes:
- Removed
BackgroundfromIFrameworkElement/FrameworkElementinterface partials and reintroduced it as independent DPs on the WinUI declarer types (plus related call-site updates). - Updated hit-testing and various control/template bindings to use the correct declaring type’s
BackgroundProperty. - Added/updated unit + runtime tests and updated the BC38 spec and XAML fixtures to reflect WinUI parity (e.g.,
TextBlockno longer hasBackground).
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/Style/Generic/Generic.Native.xaml | Removes invalid TextBlock.Background template binding after Background is no longer on FrameworkElement. |
| src/Uno.UI/UI/Xaml/Shapes/Shape.cs | Removes FE-level OnBackgroundChanged override now that Shape no longer exposes Background. |
| src/Uno.UI/UI/Xaml/IFrameworkElement.cs | Removes Background from the internal FE interface surface. |
| src/Uno.UI/UI/Xaml/FrameworkElement.Interface.skia.cs | Removes FE-level Background DP implementation for Skia. |
| src/Uno.UI/UI/Xaml/FrameworkElement.Interface.reference.cs | Removes FE-level Background DP implementation for Reference. |
| src/Uno.UI/UI/Xaml/FrameworkElement.cs | Adjusts legacy hit-test behavior to no longer depend on FE-level Background. |
| src/Uno.UI/UI/Xaml/Controls/Slider/Slider.mux.cs | Updates SliderContainer background assignment to use Panel.BackgroundProperty. |
| src/Uno.UI/UI/Xaml/Controls/ScrollPresenter/ScrollPresenterPrimitives.idl.cs | Drops now-unnecessary new hiding for Background and BackgroundProperty. |
| src/Uno.UI/UI/Xaml/Controls/ScrollPresenter/ScrollPresenter.cs | Removes base.Background = … usage (FE no longer owns Background). |
| src/Uno.UI/UI/Xaml/Controls/Repeater/ItemsRepeater.Properties.cs | Adds ItemsRepeater.Background DP (WinUI declarer parity). |
| src/Uno.UI/UI/Xaml/Controls/Panel/Panel.cs | Adds Panel.Background DP and wires background rendering updates. |
| src/Uno.UI/UI/Xaml/Controls/Control/Control.cs | Adds Control.Background DP (placeholder for templates; no-op change callback). |
| src/Uno.UI/UI/Xaml/Controls/ContentPresenter/ContentPresenter.cs | Adds ContentPresenter.Background DP and keeps background rendering update path. |
| src/Uno.UI/UI/Xaml/Controls/Border/Border.cs | Adds Border.Background DP and keeps background rendering update path. |
| src/Uno.UI.UnitTests/DependencyProperty/Given_DependencyProperty.BackgroundOwnership.cs | Adds DP ownership resolution tests ensuring BackgroundProperty resolves to nearest declaring type. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_Background.cs | Adds runtime rendering tests for Background on painter types + DP independence checks. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Media/Given_VisualTreeHelper.cs | Updates hit-testability logic to check Background on concrete painter types. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Repeater/Given_ItemsRepeater.cs | Updates binding from FrameworkElement.BackgroundProperty to Border.BackgroundProperty. |
| src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_TreeView.cs | Updates template binding to use Control.BackgroundProperty. |
| src/Uno.UI.Runtime.Skia.Win32/UI/Xaml/Controls/WebView/Win32NativeWebView.cs | Updates binding to use ContentPresenter.BackgroundProperty. |
| src/SourceGenerators/XamlGenerationTests/ThemeResourcesTest.xaml | Updates TextBlock usage from Background to Foreground for forward-reference theme resource test. |
| src/AddIns/Uno.UI.Lottie/LottieVisualSource.Skottie.cs | Removes usage of AnimatedVisualPlayer.Background and clears to transparent. |
| specs/050-breaking-changes-rollup/bc38-background-to-control.md | Updates BC38 spec with verified WinUI declarer list, implementation details, and validation notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 219962 did not find any UI Test snapshots differences. |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 220127 did not find any UI Test snapshots differences. |
1597ba0 to
5959cb5
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 220435 did not find any UI Test snapshots differences. |
4868a48 to
ea06e6f
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
ea06e6f to
7e9b0b9
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
7e9b0b9 to
15acdc8
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 221131 found UI Test snapshots differences: Details
|
|
|
15acdc8 to
5cc8de9
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 221208 found UI Test snapshots differences: Details
|
|
|
4ef3043 to
40a4d25
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 221302 found UI Test snapshots differences: Details
|
|
|
40a4d25 to
3d1e74c
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 222055 found UI Test snapshots differences: Details
|
3d1e74c to
3188b7f
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 223136 found UI Test snapshots differences: Details
|
3188b7f to
28af89b
Compare
|
The build 223311 found UI Test snapshots differences: Details
|
|
|
Remove Background/BackgroundProperty (and the FrameworkElement-level OnBackgroundChanged) from FrameworkElement/IFrameworkElement, and declare it independently on the WinUI owners: Control, Panel, Border, ContentPresenter, ItemsRepeater (ScrollPresenter drops its now-pointless `new`). Page and CalendarViewBaseItem inherit it from Control. Types with no Background in WinUI (TextBlock, RichTextBlock, Shape+subclasses, Glyphs, Image, AnimatedVisualPlayer, ...) no longer expose it. OnBackgroundChanged is Uno-only plumbing (WinUI has none), so it is private protected on the painters. Consumers reading Background through a FrameworkElement-typed reference are reconciled (Slider, Lottie, Win32 AOT WebView). Removed/narrowed public members are whitelisted in the package diff under both the 6.5 and 6.6 baselines. BREAKING CHANGE: Background is no longer available on FrameworkElement; it must be accessed through Control or a painter type, matching WinUI. Impact spec: specs/050-breaking-changes-rollup/bc38-background-to-control.md Epic: #8339 Co-Authored-By: Claude Opus 4.8 <[email protected]>
28af89b to
d27d1ff
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23573/wasm-skia-net9/index.html |
|
The build 223665 found UI Test snapshots differences: Details
|
|
|
GitHub Issue: closes https://github.com/unoplatform/uno-private/issues/2056
PR Type:
What changed? 🚀
PR Checklist ✅
Screenshots Compare Test Runresults.