How to Hide ListView GridView View Column Headers in WPF?

xaml

(this.is.sparta) #1

I have the current ListView in XAML:

<ListView Grid.Row="1" ItemsSource="{Binding}" x:Name="AuditFlagList" 
         BorderThickness="0" HorizontalContentAlignment="Stretch" 
         Background="Transparent">
    <ListView.ItemContainerStyle>
        <Style TargetType="ListViewItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListViewItem">
                        <Border BorderThickness="1" BorderBrush="Transparent" CornerRadius="3" Background="White">
                            <ContentPresenter />
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ListView.ItemContainerStyle>
    <ListView.View>
        <GridView AllowsColumnReorder="False" >
            <GridViewColumn CellTemplate="{StaticResource NameCellDataTemplate}" />
            <GridViewColumn CellTemplateSelector="{StaticResource templateSelector}" />
        </GridView>
    </ListView.View>
</ListView>

The ListView Above, uses GridView View and has only Two Columns The Two columns headers are empty, So i wanted to Hide them.

How can i Hide the Column Headers?

thanks for any help.


(SAM) #2

I think you can do that by replacing the HeaderContainerStyle Of each GridViewColumn Entry in your GridView, That’s the only Way to do it.

Or if Doable you can Replace the Global GridViewColumns Style in XAML Resources.