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

How to stretch group header content to fill up the entire row?

1 Answer 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wenrong
Top achievements
Rank 1
Wenrong asked on 10 Sep 2012, 12:42 AM
My group header has a custom background, some text that need to align to the left, and some to the right. But now they are all crammed to the left of the header row. How can I make it stretch?

My header template:

<DataTemplate x:Key="alarmGridGroupTemplate">
    <Grid Background="{Binding Group.Key, Converter={StaticResource priorityToBrushConverter}}" Height="26" VerticalAlignment="Center">
        <Grid.Resources>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize" Value="14" />
                <Setter Property="Foreground" Value="White" />
                <Setter Property="VerticalAlignment" Value="Center" />
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
 
        <TextBlock Text="{Binding Path=Group.Key, Converter={StaticResource priorityToDescriptionConverter}}" Margin="3.5,0" />
        <TextBlock Grid.Column="1" Text="Count:" />
        <TextBlock Grid.Column="2" Text="{Binding Group.ItemCount}" TextAlignment="Right" Margin="5,0,11,0" />
    </Grid>
</DataTemplate>

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 10 Sep 2012, 06:35 AM
Hi Wenrong,

You need to edit the template of GridViewGroupRow and change the elements you want as illustrated in our online documentation

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Wenrong
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or