Search code examples
c#wpflistviewtransparencytableheader

Transparent background for WPF Listview Header


I wish to create a table using ListView.

The background of table header must be transparent.

How to achieve this?


Solution

  • Set the Background of the ListView to Transparent and define a GridViewColumnHeader style that sets its Background to Transparent:

    <ListView ...
              Background="Transparent">
        <ListView.Resources>
            <Style TargetType="GridViewColumnHeader">
                <Setter Property="Background" Value="Transparent" />
            </Style>
        </ListView.Resources>
        <ListView.View>
            <GridView>
                <GridViewColumn .../>
            </GridView>
        </ListView.View>
    </ListView>