Category / Section
How to customize the value cells of PivotGrid Control
1 min read
It can be achieved by writing styles for Value Cells in PivotGrid Control. Please refer the below code snippet.
XAML
<Style x:Key="valStyle" TargetType="{x:Type syncfusion:PivotGridTemplateCell}"> <Setter Property="MinHeight" Value="25"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type syncfusion:PivotGridTemplateCell}"> <StackPanel Grid.Column="1" Orientation="Horizontal" Background="Pink"> <!--Image block--> <Image Margin="2,4,1,0" Grid.Column="1" Source="{Binding ElementName=pivotGrid1, Converter={StaticResource imgConverter}}" VerticalAlignment="Top" HorizontalAlignment="Center"> <Image.Style> <Style TargetType="{x:Type Image}"> </Style> </Image.Style> </Image> <TextBlock Grid.Column="1" Margin="3,4,2,0" Text="{Binding Path=Text, RelativeSource={RelativeSource TemplatedParent}}" TextWrapping="Wrap" VerticalAlignment="Top" FontFamily="Segoe UI" FontSize="12" /> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style>
Figure: Pivot Grid shows cell templates applied to value cells