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

ItemsRepeater can't scroll manually using ChangeView when used in ScrollViewer #1610

Closed
hupo376787 opened this issue Nov 14, 2019 · 4 comments
Labels
area-ItemsRepeater area-Scrolling bug Something isn't working needs-author-feedback Asked author to supply more information. team-Controls Issue for the Controls team

Comments

@hupo376787
Copy link

hupo376787 commented Nov 14, 2019

Describe the bug
Hi, I'm using ItemsRepeater, and surrounded in a ScrollViewer. I have disabled ScrollViewer's HorizontalScrollMode and VerticalScrollMode. And I want to use ChangeView method to scroll.
But it doesn't works.
However, ScrollToHorizontalOffset/ScrollToVerticalOffset works.

Steps to reproduce the bug

Steps to reproduce the behavior:

<Grid>
                    <muxc:ItemsRepeaterScrollHost Margin="12" Loaded="ItemsRepeaterScrollHost_Loaded">
                        <ScrollViewer
                            x:Name="sss"
                            VerticalScrollBarVisibility="Hidden"
                            HorizontalScrollBarVisibility="Hidden"
                            VerticalScrollMode="Disabled"
                            HorizontalScrollMode="Disabled">
                            <muxc:ItemsRepeater
                                x:Name="HorizontalRepeater"
                                ItemsSource="{x:Bind product}"
                                ItemTemplate="{StaticResource HorizontalTemplate}">
                                <muxc:ItemsRepeater.Layout>
                                    <muxc:StackLayout Orientation="Horizontal" Spacing="12"/>
                                </muxc:ItemsRepeater.Layout>
                            </muxc:ItemsRepeater>
                        </ScrollViewer>
                    </muxc:ItemsRepeaterScrollHost>
                    <Button
                        x:Name="ButtonLeft"
                        Tapped="ButtonLeft_Tapped">
                        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE76B;" FontSize="18" />
                    </Button>

                    <Button x:Name="ButtonRight"
                        Tapped="ButtonRight_Tapped">
                        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE76C;" FontSize="18" />
                    </Button>
                </Grid>

Then use this code to scroll.
sss.ChangeView(sss.ActualWidth, null, null); This code does't not work.

But sss.ScrollToHorizontalOffset(sss.ActualWidth); works.

Expected behavior

ItemsRepeater can scroll left/right using ChangeView method.

Screenshots

Version Info

OS: 18362.418

And a weird thing is, I actually saw this bug on 18362. But last night I upgrade my pc to 1909(18363.476), ChangeView method works.

NuGet package version:

Microsoft.UI.Xaml: 2.2.190917002

Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2019 Update (18362) Yes
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

Additional context

In 18362(1903) or lower, ScrollToHorizontalOffset/ScrollToVerticalOffset works.
In 18363(1909), ChangeView and ScrollToHorizontalOffset/ScrollToVerticalOffset works.

So for a better compatible, ScrollToHorizontalOffset/ScrollToVerticalOffset is the best choice, although this api is out of date.

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Nov 14, 2019
@jevansaks jevansaks added area-ItemsRepeater team-Controls Issue for the Controls team labels Nov 14, 2019
@jevansaks
Copy link
Member

@ranjeshj is the problem that downlevel the customer needs the ItemsRepeaterScrollHost?

@jevansaks
Copy link
Member

Oops I see it in the repro. Ok, @ranjeshj can you investigate?

@jevansaks jevansaks added bug Something isn't working needs-assignee-attention Assignee needs to follow-up or investigate this issue and removed needs-triage Issue needs to be triaged by the area owners labels Nov 15, 2019
@ranjeshj
Copy link
Contributor

@RBrid - Is this expected behavior with ScrollViewer ? I know that setting some properties on ScrollViewer stop it from scrolling through interaction but i dont remember of the top of my head. Is that the same for using the APIs as well ?

@RBrid
Copy link
Contributor

RBrid commented Nov 16, 2019

@ranjeshj, no - there is no way to turn off programmatic view changes, like for user interactions.

The first key questions to answer are:

  • when the call is made, what are the values of
    sss.ActualWidth
    sss.ViewportWidth
    sss.ScrollableWidth
    ?
  • what is the return value of ChangeView? True or False?
  • is a finger down on the ScrollViewer when the call is made? (is the call triggered by a user gesture?)

Thanks.

@ranjeshj ranjeshj removed the needs-assignee-attention Assignee needs to follow-up or investigate this issue label Jan 10, 2020
@ranjeshj ranjeshj removed their assignment Jan 10, 2020
@ranjeshj ranjeshj added area-Scrolling needs-author-feedback Asked author to supply more information. labels Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ItemsRepeater area-Scrolling bug Something isn't working needs-author-feedback Asked author to supply more information. team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

5 participants