Skip to content

Support for ItemsWrapGrid #468

Open

Description

@yowl

I'm submitting a...

  • Bug report (I searched for similar issues and did not find one)

Current behavior

ListView ItemsSource works in the playground, but seems to have a problem when the ItemsSource is changed after its rendered.

Expected behavior

ListView should redraw with all the items in its ItemsSource when the ItemsSource is changed (and notified)

Minimal reproduction of the problem with instructions

Clone https://github.com/yowl/UnoStandardRefTest/tree/wasmlistview and run the wasm head. Click the Load button and you should get 2 buttons as you do in the UWP head.

Environment

Nuget Package: Uno.UI

Package Version(s): 1.43.0-dev.564

Affected platform(s):
- [ ] iOS
- [ ] Android
- [ x] WebAssembly
- [ ] Windows
- [ ] Build tasks

Visual Studio
- [ ] 2017 (version: )
- [ ] 2017 Preview (version: )
- [ ] for Mac (version: )

Relevant plugins
- [ ] Resharper (version: )

Activity

  1. yowl commented on Dec 26, 2018

    @yowl
    ContributorAuthor

    Binding and x:Bind behave the same.

  2. jeromelaban commented on Jan 11, 2019

    @jeromelaban
    Member

    This may have been fixed by #484, could you revalidate with latest master ?

  3. added
    kind/bug
    on Jan 11, 2019
  4. yowl commented on Jan 11, 2019

    @yowl
    ContributorAuthor

    image
    I'm still just getting the one item shown with Uno.UI 1.43.0-dev.614

  5. yowl commented on Jan 14, 2019

    @yowl
    ContributorAuthor

    As a simplification you can remove the binding and change the Xaml to

            <ListView x:Name="lst"
                      Grid.Column="1">
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <ItemsWrapGrid Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
            </ListView>
    

    And in the button click

            private void Load(object sender, RoutedEventArgs e)
            {
                ViewModel.Reports = new List<ReportEntity>
                             {
                                 new ReportEntity
                                 {
                                     Key = 1, Name="a"
                                 },
                                 new ReportEntity
                                 {
                                 Key = 2, Name="b"
                             }
                             };
                lst.ItemsSource = ViewModel.Reports;
                Console.WriteLine("list items " + lst.Items.Count);
            }
    

    One item will appear and Items.Count shows 0

  6. yowl commented on Jan 14, 2019

    @yowl
    ContributorAuthor

    and simpler:

            private void Load(object sender, RoutedEventArgs e)
            {
                lst.ItemsSource = new string [] {"a", "b"};
                Console.WriteLine("list items " + lst.Items.Count);
            }
    

    is the same. I see
    https://github.com/nventive/Uno/blob/0a00b15b736983daa19474b8cb9fd667059ab2cd/src/Uno.UI/UI/Xaml/Controls/ItemsControl/ItemsControl.cs#L291
    so can forget about Items.Count as that seems like a known difference

  7. carldebilly commented on Jan 16, 2019

    @carldebilly
    Member

    I just realized the problem is not related to the Items: if you check in the DOM, you can see your 2 items are there. They are "just" not arranged correctly.

    I'll continue my investigations to fix this problem...

  8. yowl commented on Jan 16, 2019

    @yowl
    ContributorAuthor

    When I wrote this I thought it was the Items so sorry if I misled you there.

  9. carldebilly commented on Jan 21, 2019

    @carldebilly
    Member

    Source of the problem : ItemsWrapGrid is not implemented on Wasm. Only ItemsStackPanel is.

    When a Panel is not implemented, only the first child gets measured & arranged, that's the default behavior of a FrameworkElement.

    Possible workarounds:

    • Use a WrapPanel instead, if you only have few items, it will work without the virtualization.
    • Use the default ItemsStackPanel which is impletement on Wasm and will virtualize.
    • You can use conditional Xaml to use a WrapPanel only on Wasm.4
  10. changed the title [-]wasm ListView ItemsSource does not update when changed[/-] [+][wasm] WrapGrid not supported[/+] on Jan 21, 2019
  11. added
    kind/enhancement
    platform/wasm 🌐
    and removed
    kind/bug
    on Jan 21, 2019
  12. changed the title [-][wasm] WrapGrid not supported[/-] [+][wasm] `ItemsWrapGrid` not supported[/+] on Jan 21, 2019
  13. 16 remaining items

  14. added
    difficulty/challenging 🤯
    on May 31, 2021
  15. SuperJMN commented on Sep 28, 2021

    @SuperJMN
    Contributor

    I thinks this #4023 is related with this issue.

  16. changed the title [-][wasm] ItemsWrapGrid (virtualizing GridView) not supported[/-] [+][WASM] Support for `ItemsWrapGrid`[/+] on Oct 24, 2022
  17. added
    area/porting 🖨️
    on Jun 2, 2023
  18. changed the title [-][WASM] Support for `ItemsWrapGrid`[/-] [+]Support for `ItemsWrapGrid`[/+] on Jun 2, 2023
  19. added theissue type on Jul 11, 2025
  20. MartinZikmund commented on Apr 7, 2026

    @MartinZikmund
    Member

    Repro generator

    This issue was classified as not reproducible with a code sample or test.

    Reason: ItemsWrapGrid has been implemented since this issue was filed and has tests in src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_GridView_Items.cs. The WASM-specific ListView ItemsSource refresh issue described in the body was filed against version 1.43.0 from 2018 and is likely resolved. If specific ItemsWrapGrid features are still broken, please file a new issue with a targeted reproduction case.

  21. MartinZikmund commented on Oct 11, 2026

    @MartinZikmund
    Member

    Some measurements on the cost of the missing ItemsWrapGrid on Skia, in case they help with prioritization.

    On master (951b7b4), the default GridView style in UnoGenericOverlay.xaml uses a plain, non-virtualizing WrapPanel as ItemsPanel (its comment says ItemsWrapGrid is not implemented on Skia). So every item gets a container up front and keeps it for the lifetime of the GridView.

    Measured on Skia Desktop (Win32), default GridView style, 5,000 items, item template Grid(120x120) { Rectangle(gradient fill), Border { TextBlock } }:

    • all 5,000 containers are realized
    • after load and a full GC, GC.GetTotalMemory(true) grows by about 865 MB (about 173 KB per tile) with the old GridViewItemExpanded template, and about 887 MB (about 177 KB per tile) with the ListViewItemPresenter template
    • realizing 1,000 tiles costs roughly 0.6-0.8 ms of UI-thread time per tile
    • each hover or selection change re-records the whole panel, around 17-20 ms per frame

    Memory, startup time and per-interaction cost therefore all scale with the item count, so any GridView with more than a few hundred items is affected. The root cause was confirmed by source inspection of the style; the numbers come from a runtime measurement. The retained cost per element (roughly 19-25 KB per UIElement) was not investigated further.

    Workaround: set a virtualizing ItemsPanel (e.g. ItemsStackPanel), or use ItemsRepeater/ItemsView with UniformGridLayout.

  22. MartinZikmund commented on Nov 7, 2026

    @MartinZikmund
    Member

    Status check against current master: this is still open as a feature gap, although the original symptom is long gone.

    • The original WASM report (only the first item showing with ItemsWrapGrid) came from the panel being unimplemented and was resolved by the workaround of using WrapPanel.
    • On master, ItemsWrapGrid is still only a generated stub marked [Uno.NotImplemented] for Skia:
      #if __SKIA__
      [global::Uno.NotImplemented]
      #endif
      public partial class ItemsWrapGrid : global::Microsoft.UI.Xaml.Controls.Panel
    • The default GridView style therefore swaps in a non-virtualizing WrapPanel:
      <!-- WinUI's GridView style, except ItemsWrapGrid is not implemented on Skia so the panel is a WrapPanel. -->
    • The managed virtualizing layout (VirtualizingPanelLayout.managed.cs) only has partial notes about ItemsWrapGrid (for example a TODO: not appropriate for ItemsWrapGrid), so a real wrap-grid virtualizing layout is still missing.

    Since the renderers are now Skia everywhere, this applies to all targets rather than only WebAssembly, so I'm updating the platform label. The measurements above show the practical cost for large GridViews, so the issue is still worth keeping open.

    This was checked as part of an AI-assisted backlog review by reading the code, not by running it. If it looks wrong, please reply and we will take another look.

  23. added
    platform/all
    and removed
    platform/wasm 🌐
    on Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/porting 🖨️difficulty/challenging 🤯kind/enhancementno-reproplatform/allproject/items 🧾

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions