Hi,
I use Setters in c# to set various formatting in pivotGrid cells.
p.e.
// CellStyle.BorderBrush
_Setter = new Setter();
_Setter.Property = BorderBrushProperty;
_Setter.Value = ControlProperties["CellStyle.BorderBrush"].Data;
pivotGrid.CellStyle.Setters.Add(_Setter);
Hi
To apply diferent format you should do this when you define your measures. The cell style does not support such property where you can define the new format.
When you define your measures then you should suply and DisplayFormat string like below:
cubeMetadata.DimensionSettings.Add(new DimensionMetadata() { SourcePropertyName = "LYUnits", DisplayName = "LY Units", //DisplayFormat = "{0:N0}" DisplayFormat = "##{0}" });
In 11.1 version which will come frist week of June, we have added such property to the grid
Regards
Now that we have 2011.1 can you please tell me how I can format the cell value?
The property we added to the control is CellFormatString. It can be used like snippet below:
pivotGrid.CellFormatString = "##{0}";
The property takes effect if not other formating strings are applyed to the measures.
RegardsTodor
Once the data is bound. Is there a way to change the format without refreshing the grid..?
You can set new display format as is shown in snippet below
private void Button_Click(object sender, RoutedEventArgs e) { object value = pivotGrid.DataSource.Result.Cells[0, 0].Value; pivotGrid.DataSource.Result.Cells[0, 0].SetValue(value, null, "{0:billion 00}"); pivotGrid.ArrangeLayout(); }
the cells array is the array with underlaying data.
hi
This method does not change the value. below is a picture from debbuger and value is not changed.
Could you tell me how you query the value?
Todor
This does change it but it changes the actual data not just the format.so next time when I query the cell, it returns the formatted data which is not what a want. Is there an elegant way of dealing with it.