Completed
Last Updated: 03 Jan 2017 13:00 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 31 Oct 2014 13:52
Category: PivotGrid
Type: Feature Request
6
ADD. RadPivotFieldList - add Localization provider
Until the feature gets implemented create a custom PivotFieldListVisualItem and translate each of the items individually:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
 
        this.radPivotFieldList1.RowLabelsControl.CreatingVisualListItem += ListControl_CreatingVisualListItem;
        this.radPivotFieldList1.ColumnLabelsControl.CreatingVisualListItem += ListControl_CreatingVisualListItem;
        this.radPivotFieldList1.ReportFiltersControl.CreatingVisualListItem += ListControl_CreatingVisualListItem;
        this.radPivotFieldList1.ValuesControl.CreatingVisualListItem += ListControl_CreatingVisualListItem;
    }
 
    private void ListControl_CreatingVisualListItem(object sender, CreatingVisualListItemEventArgs args)
    {
        args.VisualItem = new MyPivotFieldListVisualItem(this.radPivotFieldList1.ViewModel);
    }
}
 
public class MyPivotFieldListVisualItem : PivotFieldListVisualItem
{
    public MyPivotFieldListVisualItem(FieldListViewModel viewModel)
        : base(viewModel) { }
 
    protected override void CreateChildElements()
    {
        base.CreateChildElements();
 
        CommandBarDropDownButton btn = this.GetType().BaseType
            .GetField("button", BindingFlags.Instance | BindingFlags.NonPublic)
            .GetValue(this) as CommandBarDropDownButton;
 
        if (btn != null)
        {
            btn.DropDownMenu.PopupOpening += DropDownMenu_PopupOpening;
        }
    }
 
    private void DropDownMenu_PopupOpening(object sender, System.ComponentModel.CancelEventArgs args)
    {
        foreach (RadItem item in ((RadDropDownMenu)sender).Items)
        {
            // Validate and localize each of the items
            if (item is RadMenuItem)
            {
                item.Text = "MyText";
            }
        }
    }
}
0 comments