How to reproduce: check the attached project and screenshots, the correct items are shown in screenshot correct-items-calculated-field.jpg
Workaround:
public partial class Form1 : Form
{
private LocalDataSourceProvider provider;
public Form1()
{
InitializeComponent();
//Setup pivot and add calculated field
//Workaround
this.radPivotFieldList1.ValuesControl.CreatingVisualListItem += ValuesControl_CreatingVisualListItem;
}
private void ValuesControl_CreatingVisualListItem(object sender, CreatingVisualListItemEventArgs args)
{
args.VisualItem = new MyPivotFieldListVisualItem(this.radPivotFieldList1.ViewModel);
}
}
public class MyPivotFieldListVisualItem : PivotFieldListVisualItem
{
FieldListViewModel viewModel;
public MyPivotFieldListVisualItem(FieldListViewModel viewModel)
: base(viewModel)
{
this.viewModel = viewModel;
}
protected override void UpdateContextMenu()
{
base.UpdateContextMenu();
PivotFieldListItemButton button = (PivotFieldListItemButton)typeof(PivotFieldListVisualItem).GetField("button", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this);
string providerName = this.viewModel.DataProvider != null ? this.viewModel.DataProvider.GetType().FullName : String.Empty;
if (this.Data == null)
{
return;
}
if (this.Data.DataBoundItem is Value && !(providerName.Contains("Xmla") || providerName.Contains("Adomd")))
{
for (int i = 0; i < 5; i++)
{
button.Items.RemoveAt(i);
}
}
}
}