Skip to content

The ListView Extensions, SmoothScrollIntoView, should have options that only centers vertically or horizontally #647

Open
@HotCakeX

Description

@HotCakeX

Describe the bug

When we use the SmoothScrollIntoView feature in the ListView Extensions on a ListView like this

SmoothScrollIntoViewWithIndexAsync(index: DeployedPolicies.SelectedIndex, itemPlacement: ScrollItemPlacement.Center, disableAnimation: false, scrollIfVisible: true, additionalHorizontalOffset: 0, additionalVerticalOffset: 0);

On a ListView with over 20 columns and 100k rows, it centers the selected row both vertically and horizontally, which is problematic and undesired because the user needs to scroll back horizontally all the way to the left side again.

There needs to be 2 more separate options such as CenterVertically and CenterHorizontally.

The code responsible for it is located here:
https://github.com/CommunityToolkit/Windows/blob/e2eb2c7b5dcc55e0a0f1923a4f4ea45f49a4fb77/components/Extensions/src/ListViewBase/ListViewExtensions.SmoothScrollIntoView.cs#L149C16-L154C27

Steps to reproduce

SmoothScrollIntoViewWithIndexAsync(index: DeployedPolicies.SelectedIndex, itemPlacement: ScrollItemPlacement.Center, disableAnimation: false, scrollIfVisible: true, additionalHorizontalOffset: 0, additionalVerticalOffset: 0);

Expected behavior

Only center vertically.

Screenshots

No response

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 10 21H2 (Build 19044)
  • Windows 10 22H2 (Build 19045)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

Windows 11 26120.3291

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Windows 10, version 2104 (Build 20348)
  • Windows 11, version 22H2 (Build 22000)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

Preview

Visual Studio Build Number

Version 17.14.0 Preview 1.1

Device form factor

Desktop

Additional context

No response

Help us help you

Yes, but if others can assist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions