Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1750
divide cell values by 100 ?
posted

is there a way to show cell data divided by a value ?

p.e  /100

Parents
No Data
Reply
  • 17559
    Verified Answer
    posted

    Hello ipappous,

     

    I have been looking into your requirements and  in order to fulfill them I can suggest you add a style for the PivotCellControl and manually convert the shown text in the cells. You can achieve this for example by adding the following style for the PivotCellControl:

                <Style TargetType="ig:PivotCellControl">

                    <Setter Property="Template">

                        <Setter.Value>

                            <ControlTemplate TargetType="ig:PivotCellControl">

                                <Grid>

                                    <Border x:Name="Root" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"

                            Background="{TemplateBinding Background}" />

                                    <Grid>

                                        <Grid.ColumnDefinitions>

                                            <ColumnDefinition Width="*" />

                                        </Grid.ColumnDefinitions>

                                        <TextBlock Name="cellPresenter" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Cell, Converter={StaticResource con}}"

                                    Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" />

                                    </Grid>

                                </Grid>

                            </ControlTemplate>

                        </Setter.Value>

                    </Setter>

                </Style>

     

    And convert the value as follows:

     

       public class FormatValueConverter : IValueConverter

        {

            #region IValueConverter Members

     

     

            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

            {

                if (value != null)

                {

                    PivotCell pCell = (value as PivotCell);

                    ICell cell = pCell.Data as ICell;

                    if (cell != null&& cell.Value is double)

                    {

                       

                        return (double)cell.Value / 100;

                    }

                }

     

                return "";

            }

     

            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

            {

                return "";

            }

     

            #endregion

        }

     

    If you need any further assistance on this matter, please do not hesitate to ask.

Children
No Data