uno
uno copied to clipboard
FlipView background not working on iOS
Current behavior
Create a new Uno app and use this XAML code:
<StackPanel>
<TextBlock Text="Text1" />
<FlipView Width="500" Height="500" Background="Red" />
<TextBlock Text="Text2" />
</StackPanel>
Expected behavior
No response
How to reproduce it (as minimally and precisely as possible)
No response
Workaround
N/A
Works on UWP/WinUI
Yes
Environment
Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia, Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
NuGet package version(s)
No response
Affected platforms
Android
IDE
Visual Studio 2022
IDE version
17.6.4
Relevant plugins
No response
Anything else we need to know?
No response
I tried a fix that didn't seem to work.
https://github.com/unoplatform/uno/pull/13204
var snapshot = await TakeScreenshot(parent);
var sample = parent.GetRelativeCoords(SUT);
var centerX = sample.X + sample.Width / 2;
var centerY = sample.Y + sample.Height / 2;
ImageAssert.HasPixels(
snapshot,
ExpectedPixels.At(centerX, centerY).Named("center with color").Pixel(Colors.Red));
there are two problems here:
- the
snapshotis in physical coords, while thesampleare in logical coords which is affect android, but not ios - (probably specific to the templated-parent rework branch,) we are template-binding the Background property from the ItemsPanel to the FlipView crossing two templates (ControlTemplate + ItemsPanelTemplate):
note that currently on master, NativeFlipView has FlipView for TP, so the binding could work.FlipView ItemsPresenter // TemplatedParent=FlipView, Background=(well, is not set) ContentControl // maybe present, for header NativeFlipView // TemplatedParent=ItemsPresenter, Background={TemplateBinding Background}(ItemsPresenter doesnt have a Background set) ContentControl // maybe present, for footer
No longer relevant for Skia targets, where it works correctly