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();
}
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.