unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.45k stars 685 forks source link

`ItemsStackPanel` not playing well with `ItemsControl` #16531

Open eriklimakc opened 2 weeks ago

eriklimakc commented 2 weeks ago

Current behavior

On Desktop the items are overlaying each other. On Android the ItemsControl doesn't show anything. On WASM nothing is displayed, not even the TextBlock.

Code

<TextBlock Text="ItemsControl" FontSize="20"  Margin="10" />

<ItemsControl ItemsSource="{Binding SampleData}">
  <ItemsControl.ItemTemplate>
    <DataTemplate>
      <TextBlock Text="{Binding}" />
    </DataTemplate>
  </ItemsControl.ItemTemplate>
  <ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
      <ItemsStackPanel Orientation="Horizontal" />
    </ItemsPanelTemplate>
  </ItemsControl.ItemsPanel>
</ItemsControl>
public class MainViewModel
{
    public List<string> SampleData { get; set; }

    public MainViewModel()
    {
        SampleData = new List<string>
        {
            "Item 1",
            "Item 2",
            "Item 3",
        };
    }
}

Desktop

image

Android

image

WASM

Doesn't show anything at all

Expected behavior

Windows

image

How to reproduce it (as minimally and precisely as possible)

Repro app -> UnoApp8.zip

Workaround

Use StackPanel instead of ItemsStackPanel.

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

"Uno.Sdk": "5.2.108"

<UnoExtensionsVersion>4.1.14</UnoExtensionsVersion>
<UnoToolkitVersion>6.0.18</UnoToolkitVersion>
<UnoThemesVersion>5.0.13</UnoThemesVersion>

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

If I use ListView instead of ItemsControl it works everywhere, but Android doesn't. If I use StackPanel instead of ItemsStackPanel it works everywhere.

agneszitte commented 2 weeks ago

cc @dr1rrb, @MartinZikmund, @jeromelaban

agneszitte commented 1 week ago

@eriklimakc is this a blocker for a project or a solution please?

eriklimakc commented 1 week ago

@eriklimakc is this a blocker for a project or a solution please?

No, not a blocker at the moment.

cc @agneszitte