microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.36k stars 678 forks source link

ListView with Horizontal Scrolling nested in a ScrollViewer does not allow the parent container to vertically scroll with the mouse wheel #10172

Open JLucasK opened 2 hours ago

JLucasK commented 2 hours ago

Describe the bug

A ListView that has horizontal scrolling active (desired width is greater than the available width) does not allow a parent ScrollViewer to vertically scroll with the mouse wheel.

In my testing, touch pad and touch seem work work, just the mouse scroll wheel exhibits the issue.

Additionally, horizontally scrolling the vertical ScrollViewer using a mouse with a dedicated horizontal scroll wheel causes the viewer to scroll up and down. Not sure if that's related, but something else I observed.

Steps to reproduce the bug

Either add code like the following or run this sample project: ScrollTestWinui.zip

<ScrollViewer>
    <StackPanel>
        <!-- Extra content to give give the ScrollViewer extra content -->
        <ListView
            ItemsSource="{x:Bind Items}"
            ScrollViewer.HorizontalScrollBarVisibility="Auto"
            ScrollViewer.HorizontalScrollMode="Auto">
            <ListView.ItemTemplate>
                <DataTemplate x:DataType="x:String">
                    <TextBlock Text="{x:Bind}" />
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <!-- Extra content to give give the ScrollViewer extra content -->
    </StackPanel>
</ScrollViewer> 
// Property
public List<string> Items { get; set; }

// Assignment[ScrolTestWinui.zip](https://github.com/user-attachments/files/17779503/ScrolTestWinui.zip)
[ScrollTestWinui.zip](https://github.com/user-attachments/files/17779506/ScrollTestWinui.zip)

Items = new List<string>()
{
    "Test","test1","test2","test3","scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll scroll "
};

Then, size the window such that the ListView does not need to scroll horizontally. Place the cursor on the ListView and try to scroll vertically with your mouse wheel. The parent ScrollViewer should scroll successfully.

Now, size the window such that the ListView does need to scroll horizontally. Place the cursor on the ListView and try to scroll vertically with your mouse wheel. The parent ScrollViewer does not scroll successfully.

Additional Obsevation

Size the window to any size, but place your cursor on the area not included by the ListView. Horizontally scroll with a mouse that has a horizontal scroll wheel. The ScrollViewer scrolls vertically.

Expected behavior

Attempting to vertically scroll when a ListView is not vertically scrollable and is inside of a ScrollViewer should cause the ScrollViewer to scroll

Screenshots

Attached sample project should look like this. Image

NuGet package version

None

Windows version

No response

Additional context

Using Microsoft.WindowsAppSDK 1.6.240923002

github-actions[bot] commented 2 hours ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

JLucasK commented 1 hour ago

Additionally, it seems like setting a Height on the ListView that is less than its DesiredHeight causes the same issue.