user626528
user626528

Reputation: 14419

How to make DataGrid transparent?

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

Answers (7)

Jsem Sláva
Jsem Sláva

Reputation: 1

When you inicialize datagrid put this tag GridLinesVisibility with argument None

For example:

<DataGrid GridLinesVisibility="None"/>

Upvotes: 0

&#216;rjan Tufte
&#216;rjan Tufte

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

kazem
kazem

Reputation: 3749

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

Upvotes: 2

user626528
user626528

Reputation: 14419

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

Upvotes: 23

isxaker
isxaker

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

BenCr
BenCr

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

Bala R
Bala R

Reputation: 108957

Have you tried setting the Opacity property to 0.0 ?

A value of 0.0 makes the element completely transparent

Upvotes: 2

Related Questions