2015-01-27 2 views
1

DataGridColumnHeader.BorderThickness = 0은 저에게는 효과적이지만 DataGridRow 또는 DataGridCell에는 효과가 없습니다.WPF DataGridCell BorderThickness = 0이 작동하지 않습니다.

<DataGrid x:Name="dg"> 
    <DataGrid.Resources> 
     <Style TargetType="DataGrid"> 
      <Setter Property="Background" Value="Transparent" /> 
      <Setter Property="BorderThickness" Value="0" /> 
     </Style> 
     <Style TargetType="DataGridColumnHeader"> 
      <Setter Property="Background" Value="Transparent" /> 
      <Setter Property="BorderBrush" Value="Black" /> 
      <Setter Property="BorderThickness" Value="0 0 0 1" /> 
     </Style> 
    </DataGrid.Resources> 
</DataGrid> 

결과 :이 NoneGridLinesVisibility에 속성을 설정함으로써 달성 될 수

enter image description here

답변

2

.

<DataGrid x:Name="dg" DataGrid.GridLinesVisibility="None"> 
    ... 

당신은 설정 - 3 개 테두리 스타일이있는 BorderThickness에 의해 영향을받는 DataGrid의 어느 부분이 이해하기 위해 다음 코드 놀 수있는, 각각 다른 색상을 가지고있다.

<DataGrid x:Name="dg" > 
    <DataGrid.Resources> 
     <Style TargetType="DataGridCell"> 
      <Setter Property="BorderThickness" Value="1" /> 
      <Setter Property="BorderBrush" Value="Red" /> 
     </Style> 
     <Style TargetType="DataGrid"> 
      <Setter Property="Background" Value="Transparent" /> 
      <Setter Property="BorderThickness" Value="1" /> 
      <Setter Property="BorderBrush" Value="Green" /> 
     </Style> 
     <Style TargetType="DataGridColumnHeader"> 
      <Setter Property="Background" Value="Transparent" /> 
      <Setter Property="BorderBrush" Value="Black" /> 
      <Setter Property="BorderThickness" Value="0 0 0 1" /> 
     </Style> 
    </DataGrid.Resources> 
</DataGrid> 
+0

대단히 감사합니다. 이걸 도와 줄 수있어? [link] (http://stackoverflow.com/questions/28163775/wpf-datagridcolumnwidth-doesnt-work-well-when-printvisual) – alkk

관련 문제