Localization provider

4 posts, 0 answers
  1. ANTON
    ANTON avatar
    4 posts
    Member since:
    Apr 2016

    Posted 11 May Link to this post

    Trying to apply RadChartView localization. When overriding string "PaletteArctic" (lines 8,9) - the corresponding context menu item in control will not change the color of the chart.

    Please reply if it is a bug or im doing it wrong way...

    01.public ref class MyRadChartLocalizationProvider : Telerik::WinControls::UI::RadChartLocalizationProvider
    02.{
    03.public:
    04.    virtual String^ GetLocalizedString(String ^id) override
    05.    {
    06.        if( id == "Palette" )
    07.            return "Palette";
    08.        else if( id == "PaletteArctic" )
    09.            return "123";
    10.
    11.        return Telerik::WinControls::UI::RadChartLocalizationProvider::GetLocalizedString(id);
    12.    }
    13.};

    Telerik::WinControls::UI::RadChartLocalizationProvider::CurrentProvider = gcnew MyRadChartLocalizationProvider;

    c++/cli, visual studio 2010, RadControls_WinForms_2012_3_1017_dev

  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 11 May Link to this post

    Hello Anton,

    Thank you for writing.

    We do not have any other reports of similar behavior. In addition, your code looks correct, however, you should set the localization provider in the forms constructor before the call of the InitializeComponent method.

    In addition, the localization provider for RadChartView was introduced in Q1 2013 SP1 (version 2013.1.321). This is described in the release notes: Release History. You should not be able to use the provider with the 2012_3_1017 version. Could you please check which version you are using?

    I am looking forward to your reply.

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. ANTON
    ANTON avatar
    4 posts
    Member since:
    Apr 2016

    Posted 11 May in reply to Dimitar Link to this post

    The version in the post above was incorrect, using Telerik_UI_For_WinForms_2016_1_216_Dev.msi

    Initialization of localizators occurs before Application::Run, in main, and the localizations for other controls (commandbar, dock, message) works correctly.

  5. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 12 May Link to this post

    Hello Anton,

    Thank you for writing back.

    I was able to reproduce the observed issue with the specified version (2016.1.2016). I have logged the issue in our Feedback Portal. You can track the item for status changes and add your vote for it here.

    This issue is caused because the palette is retrieved according to the menu item text. So to workaround this you should override the method which creates the context menu: 
    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());
            }
        }
    }

    You can use the above controler like this:
    this.radChartView1.Controllers.Add(new MyChartDataPointElementController());

    Your Telerik Points have been updated for this report.

    Should you have any other questions do not hesitate to ask.
     
    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top