Articles in this section
Category / Section

How to add titles to column headers

1 min read

We don’t have support to bind the titles for the column header without Grouping Bar in our control and we would like to inform you that we have created an sample with the Textblock above the column (as shown in “pivotgrid with textblock above the column” fig) in the pivotgrid. We hereby inform you that you can give your own text which you want to display manually (as in the highlighted part in below code) in the TextBlock code within the Window.Resources.

XAML

<Window.Resources>
<ResourceDictionary>
<ObjectDataProvider x:Key="data" ObjectType="{x:Type local:ProductSales}" MethodName="GetSalesData"/>
<ControlTemplate x:Key="PivotGridControlControlTemplate1" TargetType="{x:Type syncfusion:PivotGridControl}">
                <Border x:Name="PART_GridOuterBorder" BorderBrush="{Binding GridOuterBorderBrush, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="1">
                                <Grid Margin="0">
                                                <Grid.RowDefinitions>
                                                                <RowDefinition Height="40"/>
                                                                <RowDefinition x:Name="PART_GroupingBarRowDefinition"/>
                                                                <RowDefinition Height="*"/>
                                                </Grid.RowDefinitions>
                                                                                                <TextBlock Text="Text block" VerticalAlignment="Center" HorizontalAlignment="Center " Background="Red" FontWeight="Black" />
                                                                <syncfusion:PivotGridGroupingBar x:Name="PART_PivotGridGroupingBar" ColumnHeaderArea="{x:Null}" DataHeaderArea="{x:Null}" FilterHeaderArea="{x:Null}" GridControl="{x:Null}" Grid.Row="1" RowHeaderArea="{x:Null}">
                                                                <syncfusion:PivotGridGroupingBar.ContextMenu>
 

 

D:\documentation\PivotGrid Demo1\pivotgrid with textblock above the column.PNGFigure: Pivot Grid shows the customized Text Block

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied