Category / Section
How to change row/column header value?
1 min read
You can change the row header value in OLAP Grid by using the following code examples.
XAML
<Grid.Resources> <conv:StringConverter x:Key="stringConv"/> <Style x:Key="colStyle" TargetType="{x:Type olapgrid:OlapGridTemplateCell}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type olapgrid:OlapGridTemplateCell}"> <TextBlock Margin="5" Text="{Binding Path=CellValue, Converter={StaticResource stringConv}}" Foreground="White" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Calibri" FontSize="12"/> </ControlTemplate> </Setter.Value> </Setter> </Style> </Grid.Resources> <olapgrid:OlapGrid Name="olapGrid1" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowHeaderCellsToolTip="True" VisualStyle="Blend" OlapDataManager="{Binding GridDataManager}"> <olapgrid:OlapGrid.SummaryRowStyle> <olapgrid:OlapGridCellStyle Style="{StaticResource colStyle}"/> </olapgrid:OlapGrid.SummaryRowStyle> </olapgrid:OlapGrid>
C#
public class StringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string val = "Enter the text you want to display"; if (value != null) { if (value.Equals("Total")) { return val; } } return value; } }
VB
Public Class StringConverter Implements IValueConverter Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Dim val As String = "Enter the text you want to display" If value IsNot Nothing Then If value.Equals("Total") Then Return val End If End If Return value End Function End Class