C# 如何为DataGrid设置透明背景?

C# 如何为DataGrid设置透明背景?,c#,.net,wpf,xaml,C#,.net,Wpf,Xaml,如何将透明背景设置为数据网格 以下情况不起作用: <DataGrid Background="Transparent" > <DataGrid.CellStyle> <Style TargetType="DataGridCell"> <Setter Property="Background" Value="Transparent"/> </Style> <

如何将透明背景设置为
数据网格

以下情况不起作用:

<DataGrid  Background="Transparent"  >
    <DataGrid.CellStyle>
        <Style TargetType="DataGridCell">
            <Setter Property="Background" Value="Transparent"/>
        </Style>
    </DataGrid.CellStyle>
</DataGrid>

它会像雪一样洁白,代码为:)

编辑:

更新了代码(复制粘贴问题)

您需要将也设置为透明:

<DataGrid Background="Transparent" RowBackground="Transparent">


这不是您正在使用的代码(查看第一行中的“false”)仍然没有看到您预期的效果?不要忘记您可以设置
HeadersVisibility=“None”