Articles in this section
Category / Section

How to change the texts, "Total" and "Grand Total" in the summary header for Silverlight OlapGrid?

1 min read

You can change the texts, Total and Grand Total in the summary header of the OLAP Grid by using the TemplateCell property of the OLAP Grid as illustrated in the following code example.

XAML

<UserControl.Resources>
<Utils:TextConverter x:Key="textConverter"></Utils:TextConverter>
        <Style x:Key="sumCell" TargetType="syncfusion:OlapGridTemplateCell">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="syncfusion:OlapGridTemplateCell">
                        <StackPanel Background="Honeydew">
                            <TextBlock Text="{Binding Converter={StaticResource textConverter}}"/>
                        </StackPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
</UserControl.Resources>
<syncfusion:OlapGrid Height="400" x:Name="olapGrid" FreezeHeaders="True" VisualStyle="Office2007Blue" OlapDataManager="{Binding OlapDataManager}" >
<syncfusion:OlapGrid.SummaryColumnStyle>
<syncfusion:OlapGridCellStyle Style="{StaticResource sumCell}"/>
</syncfusion:OlapGrid.SummaryColumnStyle>
<syncfusion:OlapGrid.SummaryRowStyle>
<syncfusion:OlapGridCellStyle Style="{StaticResource sumCell}"/>
</syncfusion:OlapGrid.SummaryRowStyle>
</syncfusion:OlapGrid>

C#

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string text = null;
            PivotCellDescriptor cellinfo = value as PivotCellDescriptor;
            if (cellinfo != null && cellinfo.DoubleValue == 0.0)
            {
                switch (cellinfo.CellValue)
                {
                    case "Total":
                        text = "агульны";
                        return text;
                    case "Grand Total":
                        text = "агульны";
                        return text;
                }
            }
            else
            {
                text = cellinfo.CellValue;
            }
            return text;
        }

VB

Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object
        Dim text As String = Nothing
            Dim cellinfo As PivotCellDescriptor =  value as PivotCellDescriptor 
        If cellinfo <> Nothing And cellinfo.DoubleValue = 0.0 Then
            Select Case cellinfo.CellValue
                Case "Total"
                    text = "агульны"
                    Return text
                Case "Grand Total"
                    text = "агульны"
                    Return text
            End Select
        Else
            text = cellinfo.CellValue
        End If
        Return text
    End Function

 

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