Click here to Skip to main content
13,445,503 members (37,476 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I got this XAML for my ListView:

<Grid x:Name="gSearch"  Grid.Row="1" Margin="0,45,871,0" >
                        <ListView x:Name="lVsearch" Height="472" Margin="15,7,5,17" SelectionMode="Single" 


                                      HorizontalContentAlignment="Stretch" ScrollViewer.CanContentScroll="True" >
                                    <Border CornerRadius="3" BorderThickness="1" BorderBrush="LightGray" Background="{TemplateBinding Background}">
                                <Style TargetType="{x:Type ListViewItem}">
                                    <Setter Property="Template">
                                            <ControlTemplate TargetType="{x:Type 
                                                <Border x:Name="Border" 
                                                BorderBrush ="LightGray" 
                                                 BorderThickness="0 0 0 1">
                                                    <ContentPresenter />
                                                    <Trigger Property="IsMouseOver" 




                                                    <Trigger Property="IsSelected" 



                                                     TargetName="Border" Value="#FF3266A0"></Setter>
                                                        <Setter Property="Foreground" Value="White"></Setter>
                                        <TextBlock Text="{Binding Bez}" />
                                        <TextBlock Text=" (" />
                                        <TextBlock Text="{Binding ArtNr}" />
                                        <TextBlock Text=" | " />
                                        <TextBlock Text="{Binding SlNr}"/>
                                        <TextBlock Text=")" />

i don't know why the ListView is not showing the ScrollBars?

What I have tried:

ScrollViewer.CanContentScroll = true
Posted 18-Jun-17 23:33pm
Updated 19-Jun-17 5:52am
Richard MacCutchan 19-Jun-17 7:13am
Does the list contain enough items to require a scrollbar?
Member 12969975 19-Jun-17 7:23am
for sure, it just go further in the list but without the scrollbars :(
George Swan 19-Jun-17 12:38pm
Try this. Wrap a ScrollViewer around the ListView. Set the Margin and Height inside the ScrollViewer tag and remove the Margin and Height references from the ListView as well as the ScrollViewer.CanContentScroll="True" reference.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need a ScrollViewer in your control template:
        <Border CornerRadius="3" BorderThickness="1" BorderBrush="LightGray" Background="{TemplateBinding Background}">
            <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="False">
                <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180314.2 | Last Updated 19 Jun 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100