We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Stacked column header wrap text

Hi,

How can I wrap header text in the Stacked Column header? or show text in a smaller font when it doesn't fit in the provided column width? 

Thanks,
Vasanth

3 Replies

FP Farjana Parveen Ayubb Syncfusion Team June 5, 2015 09:52 AM UTC

Hi Vasanth,

Thank you for contacting Syncfusion support.

We have analyzed the reported query and you can achieve this by customizing the GridStackedHeaderCellControl in SfDataGrid.

Please refer the below code snippet and sample in the following location:


Code Snippet:

        <Style TargetType="syncfusion:GridStackedHeaderCellControl">

            <Setter Property="Template">

                <Setter.Value>

                    <ControlTemplate TargetType="syncfusion:GridStackedHeaderCellControl">

                        <Border Background="{TemplateBinding Background}"

                            BorderBrush="{TemplateBinding BorderBrush}"

                            BorderThickness="{TemplateBinding BorderThickness}">

                            <Grid Margin="{TemplateBinding Padding}">

                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"

                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"

                                              FontFamily="{TemplateBinding FontFamily}"

                                              FontSize="{TemplateBinding FontSize}"

                                              FontWeight="{TemplateBinding FontWeight}">

                                            <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Content}"    TextWrapping="Wrap"/>

                                </ContentPresenter>

                            </Grid>

                        </Border>

                    </ControlTemplate>

                </Setter.Value>

            </Setter>
        </Style>


Sample Location: StackedHeader_TextWraping

Regards,
Farjana Parveen A


VA Vasanth June 5, 2015 02:45 PM UTC

Awesome, thank you. Worked like a champ!


SC Saranya CJ Syncfusion Team June 8, 2015 05:28 AM UTC

Hi Vasanth,
Thank you for your update. Please let us know if you require any other assistance on this.
Regards,
Saranya

Loader.
Live Chat Icon For mobile
Up arrow icon