Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting MaximumRowsOrColumns property of UniformGridLayout causes holes and crashes in ItemsRepeater. #1887

Closed
MilesChing opened this issue Jan 26, 2020 · 3 comments · Fixed by #3393
Labels

Comments

@MilesChing
Copy link

Describe the bug

Setting MaximumRowsOrColumns property of UniformGridLayout causes holes and crashes in ItemsRepeater. Holes appear in the upper right corner when using the latest stable version 2.3.191211002 of Microsoft.UI.Xaml.Controls on Nuget. Sliding errors with the ScrollViewer occur as well. The application crashed directly when scrolling the ScrollViewer using the latest prereleased version 2.4.0-prerelease.200113001.

Steps to reproduce the bug

The test code is as follows

<!--MainPage.xaml-->
<Page
    x:Class="TestApplication.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:TestApplication"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Page.Resources>
        <!-- The Layout specifications used: -->
        <muxc:UniformGridLayout x:Name="UniformGridLayout"
                                MinRowSpacing="8" MinColumnSpacing="8"
                                MaximumRowsOrColumns="4"/>

        <!-- The DataTemplate used: CircularTemplate-->

        <DataTemplate x:Key="CircularTemplate" x:DataType="local:Bar">
            <Grid Background="Red"
                  Width="100"
                  Height="100">
                <TextBlock Text="{x:Bind str}" 
                           FontSize="20"/>
            </Grid>
        </DataTemplate>
    </Page.Resources>

    <ScrollViewer HorizontalScrollBarVisibility="Auto" 
        HorizontalScrollMode="Auto" 
        IsVerticalScrollChainingEnabled="False"
        MaxHeight="500">
        <muxc:ItemsRepeater
            ItemsSource="{x:Bind collection}"
            Layout="{StaticResource UniformGridLayout}"
            ItemTemplate="{StaticResource CircularTemplate}"
        />
    </ScrollViewer>
</Page>
//MainPage.xaml.cs
using System;
using System.Collections.ObjectModel;
using Windows.UI.Xaml.Controls;

namespace TestApplication
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            for (int i = 0; i < 40; ++i)
                collection.Add(new Bar(i.ToString()));
        }

        public ObservableCollection<Bar> collection
            = new ObservableCollection<Bar>();
    }

    public class Bar
    {
        public Bar(string str) { this.str = str; }

        public String str;
    }
}

Screenshots

a

Version Info

Windows 10 18363.592

NuGet package version:

  • Microsoft.UI.Xaml 2.4.0-prerelease.200113001
  • Microsoft.UI.Xaml 2.3.191211002
Windows 10 version Saw the problem?
Insider Build (xxxxx)
November 2019 Update (18363) Yes
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT
@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Jan 26, 2020
@ranjeshj
Copy link
Contributor

ranjeshj commented Jan 26, 2020

@MilesChing Is this specifically when using MaximumRowsOrColumns?
Which OS are you running on ? For this scenario to work downlevel, you will need to add ItemsRepeaterScrollHost, since ScrollViewer does not perform anchoring downlevel. ItemsRepeaterScrollhost is the interim solution until WinUI3 at which point it will not be needed.

@MilesChing
Copy link
Author

@MilesChing Is this specifically when using MaximumRowsOrColumns?
Which OS are you running on ? For this scenario to work downlevel, you will need to add ItemsRepeaterScrollHost, since ScrollViewer does not perform anchoring downlevel. ItemsRepeaterScrollhost is the interim solution until WinUI3 at which point it will not be needed.

Yes and it don't happen when MaximumRowsOrColumns is not set.
I'm running the test code on version 1909. It seems that this version does not require an ItemsRepeaterScrollHost, and using it doesn't work.

@ranjeshj ranjeshj removed the needs-triage Issue needs to be triaged by the area owners label Jan 28, 2020
@marcelwgn
Copy link
Collaborator

I would like to look into this issue (feel free to assign this to me),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants