簡體   English   中英

如何擺脫 WPF 列表視圖中 ListViewItem 上的圓角?

[英]How can I get rid of the rounded corners on the ListViewItem in a WPF listview?

我有一種應用於 Listview 的 ItemContainerStyle 的樣式。 它在行的底部放置一條線並設置行的高度。

但是由於某種原因 - 每行似乎都有圓角(如所附快照所示)。 當我查看 Blend 中的樣式時 - 沒有圓角。

我怎樣才能擺脫圓角?

<Style TargetType="ListViewItem" x:Key="RowStyle">
                <Setter Property="BorderThickness" Value="0,0,0,1" />
                <Setter Property="BorderBrush" Value="{DynamicResource ButtonPressedColor}" />
                <Setter Property="Height" Value="40" />
                <Setter Property="Background" Value="#FFF9EDED"/>

            </Style>            

        <ListView x:Name="lvw_FileList" Background="{DynamicResource Watermark}" ItemContainerStyle="{StaticResource RowStyle}" BorderBrush="{DynamicResource GreyBorderColor}" BorderThickness="3" Margin="0" ItemsSource="{Binding Mode=OneWay}" d:DataContext="{d:DesignData /SampleData/SampleListItems.xaml}" Foreground="{DynamicResource TextColor}">    
            <ListView.View>
                <GridView AllowsColumnReorder="False">
                    <GridView.ColumnHeaderContainerStyle>
                        <Style>
                            <Setter Property="UIElement.Visibility" Value="Collapsed" />
                        </Style>
                    </GridView.ColumnHeaderContainerStyle>                  
                    <GridViewColumn Header="Picture" CellTemplate="{DynamicResource PictureCell}" />
                    <GridViewColumn Header="Name" CellTemplate="{DynamicResource CompanyNameCell}" />                   
                    <GridViewColumn Header="Action" CellTemplate="{DynamicResource ActionCell}" />
                    <!--<GridViewColumn Header="Delete" Width="50"/>-->
                </GridView>
            </ListView.View>            
        </ListView>

ListViewItems 上的圓角

Round conrner 就是因為這條線。 您已將厚度 1 分配給底部

<Setter Property="BorderThickness" Value="0,0,0,1" />

將其更改為

 <Setter Property="BorderThickness" Value="0,0,0,0" />

我認為這與 ListView 的樣式無關,而與 ListView 內的 GridViewColumn 的樣式無關。 因為缺少那種風格。

你能發布你的樣本數據 xml 嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM