uno icon indicating copy to clipboard operation
uno copied to clipboard

FlipView background not working on iOS

Open ajpinedam opened this issue 2 years ago • 2 comments

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

ajpinedam avatar Jul 04 '23 19:07 ajpinedam

I tried a fix that didn't seem to work.

https://github.com/unoplatform/uno/pull/13204

Youssef1313 avatar Aug 18 '23 11:08 Youssef1313

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:

  1. the snapshot is in physical coords, while the sample are in logical coords which is affect android, but not ios
  2. (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):
    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
    
    note that currently on master, NativeFlipView has FlipView for TP, so the binding could work.

Xiaoy312 avatar Aug 23 '24 19:08 Xiaoy312

No longer relevant for Skia targets, where it works correctly

MartinZikmund avatar Jul 21 '25 13:07 MartinZikmund