This is a migrated thread and some comments may be shown as answers.

[Solved] Custom Headers - Resize

1 Answer 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stephane
Top achievements
Rank 1
Stephane asked on 27 Oct 2011, 11:46 PM
Hi,

I got a custom header shown in the code below. The problem is that I lose the column resizing ability when I do so. How can I enable it back?

<telerik:GridViewDataColumn x:Name="freightStatus" DataMemberBinding="{Binding LoadFreightStatusID, Converter={StaticResource FreightStatusConverter}}" Width="125" Header="Freight Status">
          <telerik:GridViewDataColumn.HeaderCellStyle>
            <Style TargetType="telerikheadercell:GridViewHeaderCell">
              <Setter Property="Template">
                <Setter.Value>
                  <ControlTemplate>
                    <Border BorderBrush="#FF0AA0FF" BorderThickness="0,0,1,0">
                      <StackPanel Orientation="Vertical">
                        <Grid>
                          <TextBlock Text="{Binding Strings.orderFreightStatus, Source={StaticResource res}}" Height="22" Margin="1,0,22,0" Padding="3, 3"/>
                          <TextBlock Width="22" Text="▲▼" Height="22" VerticalAlignment="Center" HorizontalAlignment="Right" Padding="0, 2" Margin="0,0,2,0"/>
                        </Grid>
                        <TextBlock/>
                      </StackPanel>
                    </Border>
                  </ControlTemplate>
                </Setter.Value>
              </Setter>
            </Style>
          </telerik:GridViewDataColumn.HeaderCellStyle>
        </telerik:GridViewDataColumn>

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 28 Oct 2011, 03:41 PM
Hi Stephane,

Instead of switching the whole template of the header cell , you can place your custom content using the Header property of the column .This will keep the resizing elements of the cell.

In other words remove the setting of the HeaderStyle and set the header of the Column to :
<Border BorderBrush="#FF0AA0FF" BorderThickness="0,0,1,0">
  
                      <StackPanel Orientation="Vertical">
  
                        <Grid>
  
                          <TextBlock Text="{Binding Strings.orderFreightStatus, Source={StaticResource res}}" Height="22" Margin="1,0,22,0" Padding="3, 3"/>
  
                          <TextBlock Width="22" Text="▲▼" Height="22" VerticalAlignment="Center" HorizontalAlignment="Right" Padding="0, 2" Margin="0,0,2,0"/>
  
                        </Grid>
  
                        <TextBlock/>
  
                      </StackPanel>
  
                    </Border>





Best wishes,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Stephane
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or