Listview selection event event is firing when we click on scroll viewer

Sunil A M 171 Reputation points
2024-04-05T06:37:57.6+00:00

Hi Team,

i am win ui3 application using windows app sdk version - 1.4.240

I have "list view" inside the "scroll viewer" control .

List view - has selection changed event

Problem : when i click on the scroll viewer, List view selection changed event is firing.

COuld you please help us to resolve this issue?

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
798 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 12,726 Reputation points Microsoft Vendor
    2024-04-08T03:14:10.3933333+00:00

    cannot reproduce with the following code snippet. @Sunil A M, could you please show a minimal, reproducible sample without private information?

    <ScrollViewer Width="500" Height="400">
        <StackPanel>
            <ListView SelectionChanged="ListView_SelectionChanged" Width="250">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Border Background="LightGray" Height="200" Width="200">
                                <TextBlock Text="{Binding}" 
                           FontSize="48" Foreground="Green"/>
                            </Border>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.Items>
                    <x:String>One</x:String>
                    <x:String>One1</x:String>
                    <ListViewItem>Two</ListViewItem>
                    <ListViewItem>Two2</ListViewItem>
                    <ListViewItem>Three</ListViewItem>
                </ListView.Items>
            </ListView>
            <TextBlock> AAA </TextBlock>
            
            <ListView SelectionChanged="ListView_SelectionChanged" Width="250">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Border Background="LightGray" Height="200" Width="200">
                                <TextBlock Text="{Binding}" 
               FontSize="48" Foreground="Green"/>
                            </Border>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.Items>
                    <x:String>One</x:String>
                    <x:String>One1</x:String>
                    <ListViewItem>Two</ListViewItem>
                    <ListViewItem>Two2</ListViewItem>
                    <ListViewItem>Three</ListViewItem>
                </ListView.Items>
            </ListView>
        </StackPanel>
    </ScrollViewer>
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.