简体   繁体   中英

xaml listview how to disable space for scroll?

I working on a metro app and I am using listview listview automatically puts some space on right side for scroll. In my code there is no need for scrolling I tried to disable it ScrollViewer.VerticalScrollBarVisibility="Disabled" or scrollmode=false but the space allways appears

is there a way I could disappear it because listview highlights on over and click mode and it looks bad

Create a copy of the current ListView Style by selecting Edit Additional Templates -> Edit Generated Item Container -> Edit a Copy (see screenshot below).

In the template copy, modify the Margin (last line shown below)

    <Style x:Key="ListViewItemStyle" TargetType="ListViewItem">
        <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/>
        <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="TabNavigation" Value="Local"/>
        <Setter Property="IsHoldingEnabled" Value="True"/>
        <Setter Property="Margin" Value="0,0,18,2"/>

to

        <Setter Property="Margin" Value="0" />

You'll also need to set ScrollViewer.VerticalScrollBarVisibility="Hidden" on the ListView itself (like you tried before(, or you can get adventurous and modify the template for the ListView itself (Edit Template) and remove the ScrollViewer and set the ItemsPanelTemplate to just StackPanel from VirtualizingStackPanel .

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM