Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make DataGrid transparent?

Tags:

c#

wpf

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.

like image 597
user626528 Avatar asked Mar 18 '11 15:03

user626528


4 Answers

So, my solution... use both Background="Transparent" and RowBackground="Transparent"

like image 86
user626528 Avatar answered Nov 08 '22 01:11

user626528


Have you tried setting the Opacity property to 0.0 ?

A value of 0.0 makes the element completely transparent

like image 28
Bala R Avatar answered Nov 08 '22 00:11

Bala R


<DataGrid
      Background="Transparent" RowBackground="Transparent">
</DataGrid>
like image 37
kazem Avatar answered Nov 08 '22 00:11

kazem


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>
like image 1
Ørjan Tufte Avatar answered Nov 07 '22 23:11

Ørjan Tufte