WPF: Spilt GridView header into two rows where the bottom row is seperated into two colums

I´m trying to separate a gridViewColumn into two rows. Im using default style for the listView. Its no problem to separate the column header into two rows, but it seems like the content is placed over the original style with the border etc hidden under my customized gridViewHeader content. The code looks like:

<GridViewColumnHeader>
    <GridViewColumnHeader.Template>
        <ControlTemplate>
            <Grid VerticalAlignment="Center" HorizontalAlignment="Center">
                <Grid ShowGridLines="False" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Text="SomeHeaderText" HorizontalAlignment="Center"/>
                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="SubHeaderText1" Padding="5"  HorizontalAlignment="Center" />
                            <TextBlock Grid.Column="1" Text="SubHeaderText1" Padding="5" HorizontalAlignment="Center" />                                                
                        </Grid>
                    </Grid>
            </Grid>
        </ControlTemplate>
    </GridViewColumnHeader.Template>
</GridViewColumnHeader> 

Anyone knows how to cutomized the GridViewHeader like this example and keep the appearance of the GridViewHeader

Answers


You should put your customized template just as a content of the GridViewColumnHeader, not as its template. Here is the correct XAML:

<GridViewColumnHeader>
   <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
      <Grid HorizontalAlignment="Center" VerticalAlignment="Center" ShowGridLines="False">
         <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
         </Grid.RowDefinitions>
         <TextBlock Grid.Row="0" HorizontalAlignment="Center" Text="SomeHeaderText"/>
         <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="*"/>
               <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock
               Grid.Column="0"
               HorizontalAlignment="Center"
               Padding="5"
               Text="SubHeaderText1"/>
            <TextBlock
               Grid.Column="1"
               HorizontalAlignment="Center"
               Padding="5"
               Text="SubHeaderText1"/>
         </Grid>
      </Grid>
   </Grid>
</GridViewColumnHeader>

Need Your Help

How do you unzip very large files in python?

python compression zip unzip

Using python 2.4 and the built-in ZipFile library, I cannot read very large zip files (greater than 1 or 2 GB) because it wants to store the entire contents of the uncompressed file in memory. Is ...