wpf Listview水平垂直线可见WPF

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17671417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 09:13:20  来源:igfitidea点击:

Listview Horizontal vertical line visibitly WPF

wpflistviewdatagridlistboxitemsource

提问by omeriqbal

Can anyone please tell me how can i disable the listview horizontal and vertical line visibility set to false.like in data grid we use the property gridLine=false.So is there any option for listview?

谁能告诉我如何禁用列表视图水平和垂直线可见性设置为 false.like 在数据网格中我们使用属性 gridLine=false.So 有列表视图的任何选项吗?

回答by devdigital

Assuming you're using a ListViewwith a GridViewset as the View, then the ListViewdoesn't show vertical or horizontal lines by default.

假设您使用ListView带有GridView集合的a作为View,则ListView默认情况下不显示垂直或水平线。

If you want to add horitzontal lines then you can change the border on the ListViewItem, e.g:

如果要添加水平线,则可以更改 上的边框ListViewItem,例如:

<ListView ...>
    <ListView.ItemContainerStyle>
        <Style TargetType="{x:Type ListViewItem}">
            <Setter Property="BorderBrush" Value="LightGray" />
            <Setter Property="BorderThickness" Value="0,0,0,1" />
        </Style>
    </ListView.ItemContainerStyle>
    <ListView.View>
        <GridView>
            <GridViewColumn ... />
        </GridView>
    </ListView.View>
    ...

If you want to add vertical lines then see herefor more information.

如果要添加垂直线,请参阅此处了解更多信息。