Completed
Last Updated: 20 May 2016 10:54 by ADMIN
ADMIN
Dimitar
Created on: 12 May 2016 08:32
Category: ChartView
Type: Bug Report
0
FIX. RadChartView - the palette is not changed when the palette names are localized.
To reproduce:
- Localize the palette names with the localization provider.
- Change the palette with the context menu.

Workaround:
class MyChartDataPointElementController : ChartDataPointElementController
{
    protected override RadContextMenu CreatePaletteMenu()
    {
        RadContextMenu menu = new RadContextMenu();

        RadChartLocalizationProvider localizationProvider = RadChartLocalizationProvider.CurrentProvider;

        RadMenuItem paletteItem = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.Palette));

        menu.Items.Add(paletteItem);

        RadMenuItem item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteArctic));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Arctic";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteAutumn));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Autumn";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteCold));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Gold";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteFlower));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Flower";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteForest));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Forest";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteGrayscale));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Grayscale";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteGround));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Ground";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteLilac));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Lilac";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteMetro));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Metro";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteNatural));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Natural";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PalettePastel));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Pastel";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteRainbow));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Rainbow";
        paletteItem.Items.Add(item);


        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteSpring));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Spring";
        paletteItem.Items.Add(item);


        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteSummer));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Summer";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteWarm));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Warm";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteWindows8));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Windows8";
        paletteItem.Items.Add(item);

        item = new RadMenuItem(localizationProvider.GetLocalizedString(RadChartStringId.PaletteSun));
        item.Click += new System.EventHandler(item_Click);
        item.Tag = "Sun";
        paletteItem.Items.Add(item);

        return menu;
    }

    void item_Click(object sender, System.EventArgs e)
    {
        RadMenuItem item = sender as RadMenuItem;
        if (item != null)
        {
            this.Area.View.Palette = ChartPalette.FromKnownPalette(item.Tag.ToString());
        }
    }
}

// change the controller

this.radChartView1.Controllers.Add(new MyChartDataPointElementController());
0 comments