2011-06-07 311 views
1

我有一种我应用于ListView的ItemContainerStyle的样式。它在行的底部放置一条线并设置该行的高度。我该如何摆脱WPF listview中ListViewItem的圆角?

但是由于某些原因 - 每行似乎都有圆角(如附带快照中所示)。当我看着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> 

Rounded Corners on ListViewItems

回答

0

回合conrner是因为这一行的。您分配厚度1至底部

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

改变这

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

我明白了 - 所以底层模板有一个角落半径设置的边框对象 - 只要我创建了一个边框,它就会继承这个属性。为了解决这个问题,我需要为ListItemView创建一个模板? – dan 2011-06-07 06:47:33

+0

默认情况下,如果您可以验证控件模板中的默认ListviewItemStyle Contentpresenter包装了边框并且使用Templatebinding继承厚度 – 2011-06-07 06:52:42

+0

如果您需要自定义rowstyle,则可以创建自己的ListviewItem样式 – 2011-06-07 06:56:04

0

我觉得这没有什么待办事项与您的ListView控件的样式,但你GridViewColumn ListView控件中的风格。因为这种风格缺失。

你可以发布你的样本数据xml吗?