Reputation: 14419
How to make DataGrid transparent?
I'm trying to use Background of DataGrid itself, but this doesn't seem to work.
UPD I need only background and borders transparent, not everything! Text should be visible.
Upvotes: 7
Views: 15536
Reputation: 1
When you inicialize datagrid put this tag GridLinesVisibility
with argument None
For example:
<DataGrid GridLinesVisibility="None"/>
Upvotes: 0
Reputation: 63
Try this:
Background="Transparent" RowBackground="Transparent"
and
<DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.RowHeaderStyle>
<Style TargetType="{x:Type DataGridRowHeader}">
<Setter Property="Background" Value="Transparent" />
</Style>
</DataGrid.RowHeaderStyle>
Upvotes: 1
Reputation: 3749
<DataGrid
Background="Transparent" RowBackground="Transparent">
</DataGrid>
Upvotes: 2
Reputation: 14419
So, my solution... use both Background="Transparent" and RowBackground="Transparent"
Upvotes: 23
Reputation: 9456
I'm not sure which background you are trying to change, but you can set any background by overriding the DataGrid's ControlTemplate. Your best bet is probably to copy the default DataGrid ControlTemplate from here and then modify the necessary background to match your needs.
Upvotes: 0
Reputation: 6052
It's an undocumentd feature but if you set the visability to Hidden it's the same as setting the element to transparent.
Upvotes: 0