wpf datagrid边框刷不工作

时间:2017-10-13 20:10:45

标签: wpf xaml datagrid

我很想找到一种方法来完成这项工作:

<DataGrid x:Name="name" CanUserAddRows="false"
          IsReadOnly="true" ItemsSource="{Binding}">
    <DataGrid.CellStyle>
        <Style TargetType="DataGridCell">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="Red"/>
        </Style>
    </DataGrid.CellStyle>
</DataGrid>

我只是想改变单元格边框的颜色,为什么它必须如此复杂? :/

1 个答案:

答案 0 :(得分:0)

<DataGrid
    x:Name="name" 
    CanUserAddRows="false"
    IsReadOnly="true" 
    ItemsSource="{Binding}"

    HorizontalGridLinesBrush="DeepSkyBlue"
    VerticalGridLinesBrush="YellowGreen">
</DataGrid>
相关问题