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
350
PivotGrid does not reflect DimensionMetadata changes
posted

I have a pivotGrid & a dropdown box with some numeric values(0,1,2) for setting decimal places for a column(e.g. Cost). when i select any value and set the values (2 decimal points) as below. But grid is not reflecting any change. it still shows default format with 4 decimal places. Please let me know what am i doing wrong?

private void OnADecimalSelectionComboBoxChanged(object sender, SelectionChangedEventArgs e){

if (this.DecimalSelectionComboBox == null) return;

DimensionMetadata dimData = new DimensionMetadata();

dimData.DisplayFormat = "{0:0.00}";

dimData.SourcePropertyName = "Cost";

FlatDataSource fds = (FlatDataSource)this.pivotGrid.DataSource;

fds.CubesSettings[0].DimensionSettings.Add(dimData);

this.pivotGrid.DataSource.RefreshGrid();

}

  • 8831
    Verified Answer
    posted

    Hello,

    You can try this code:

     

    DimensionMetadata metadata =

        flatDataSource.CubesSettings[0].DimensionSettings.

        Where(dm => (dm.DimensionType & DimensionType.Measure) == DimensionType.Measure &&

        dm.DisplayName == "[Your measure display name]").

        FirstOrDefault();

     

    if (metadata != null)

    {

        metadata.DisplayFormat = "[Desired format]";

    }

     

    Here we suppose you have initialized the FlatDataSource with such metadata item.


    Regards.

    Plamen.