How to make DataGrid transparent?

How to make DataGrid transparent?
I am trying to use Background of DataGrid, but this does not work.

UPD I need only a background and transparent borders, not all! The text should be visible.

+6
c # wpf
source share
6 answers

So my solution ... is used both Background = "Transparent" and RowBackground = "Transparent"

+14
source share

Have you tried setting the Opacity property to 0.0?

A value of 0.0 makes the item completely transparent.

+1
source share
<DataGrid Background="Transparent" RowBackground="Transparent"> </DataGrid> 
+1
source share

This is an undocumented feature, but if you set the visibility to β€œHidden” in the same way as setting the transparency of an element.

0
source share

I'm not sure which background you are trying to change, but you can set any background by overriding the DataGrid ControlTemplate. It is best to probably copy the default DataGrid ControlTemplate, and then change the background you want to suit your needs.

0
source share

Try the following:

 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> 
0
source share

All Articles