none
Hiding GridViewColumn Header

    Question

  • Hello,

    I have a ListBox containing a listView by row,

    For each ListView, I have a GridView inside,

    and I need to hide the Header of all the GridViewColumn,

     

    do you know if it's possible ?

    thanks,

    Friday, March 16, 2007 10:53 AM

Answers

  • Hmm I think the way to do this is to set the ColumnHeaderContainerStyle to a Style which sets the Visibility to Collapsed
    Friday, March 16, 2007 11:49 AM
  • Hello UdiMilo,

    see a full example code below :

     <Grid>
          <Grid.Resources>
            <ResourceDictionary>
              <Style x:Key="hiddenStyle" TargetType="GridViewColumnHeader">
                <Setter Property="Visibility" Value="Collapsed"/>
              </Style>
            </ResourceDictionary>
          </Grid.Resources>
          <ListView>
            <ListView.View>
              <GridView ColumnHeaderContainerStyle="{StaticResource hiddenStyle}">
                <GridViewColumn></GridViewColumn>
                <GridViewColumn></GridViewColumn>
              </GridView>
            </ListView.View>
          </ListView>
     </Grid>

    Monday, March 19, 2007 8:05 AM

All replies

  • Hmm I think the way to do this is to set the ColumnHeaderContainerStyle to a Style which sets the Visibility to Collapsed
    Friday, March 16, 2007 11:49 AM
  • Yes, it's working,

    thank you very much Neil

    Friday, March 16, 2007 1:57 PM
  • Hi,

    Im having trouble building such style... i dont know how to access the
    visibility tag.

    can you please write such a style, say called invisible, that all it does is make
    the visibility = collapsed?

    thanks!
    Friday, March 16, 2007 7:02 PM
  • Sure

    <Style TargetType="GridViewColumnHeader" x:Key="invisible">
        <Setter Property="Visibility" Value="Collapsed" />
    </Style>
    Friday, March 16, 2007 7:07 PM
  • Sorry for being so slow today,
    but after defining this in the window.resources,

    how do i call it on my style, which setter do i use?

    i've tried all kind of stuff, but its not working.
    thanks again.

    Friday, March 16, 2007 9:00 PM
  • Hello UdiMilo,

    see a full example code below :

     <Grid>
          <Grid.Resources>
            <ResourceDictionary>
              <Style x:Key="hiddenStyle" TargetType="GridViewColumnHeader">
                <Setter Property="Visibility" Value="Collapsed"/>
              </Style>
            </ResourceDictionary>
          </Grid.Resources>
          <ListView>
            <ListView.View>
              <GridView ColumnHeaderContainerStyle="{StaticResource hiddenStyle}">
                <GridViewColumn></GridViewColumn>
                <GridViewColumn></GridViewColumn>
              </GridView>
            </ListView.View>
          </ListView>
     </Grid>

    Monday, March 19, 2007 8:05 AM
  • Hi,

    And how I can hide GridViewColumnHeader and GridViewColumn?

    GridViewColumnHeader it's easy...

    <Style TargetType="GridViewColumnHeader" x:Key="invisible"
        <Setter Property="Visibility" Value="Collapsed" /> 
    </Style> 

    ... but the GridViewColumn???

    Thanks
    Friday, September 26, 2008 5:32 AM
  • i've written a small article on the matter. It shows how to hide and show a column by actually removing it from the gridview.
    http://i-zaak.eu/Lists/Posts/Post.aspx?ID=5

    Goodluck.
    Thursday, October 23, 2008 6:40 AM