After upgrading to 15.1.7 (from 15.1.6) I get an error (System.InvalidCastException) in the code below:
C#void InitChartPaletteGallery(GalleryDropDown gallery)
{
gallery.Gallery.DestroyItems();
string[] paletteNames = chartControl.GetPaletteNames();
gallery.Gallery.BeginUpdate();
for (int i = 0; i < paletteNames.Length; i++)
{
GalleryItem gPaletteItem = new GalleryItem();
gPaletteItem.Caption = paletteNames[i];
gPaletteItem.Hint = paletteNames[i];
gPaletteItem.Image = CreateEditorImage(chartControl.PaletteRepository[paletteNames[i]]);
gallery.Gallery.Groups[0].Items.Add(gPaletteItem);
}
gallery.Gallery.EndUpdate();
UpdateCurrentPalette();
}
The error comes on line 11 (CreateEditorImage) when the palletteNames[i] = "Black and White" and i=2
Here is my Localizer Class:
C#public class GenericChartLocalizer : ChartLocalizer
{
public override string Language { get { return LocalizeDevExpress.TransLanguage; } }
public override string GetLocalizedString(ChartStringId id)
{
string str = base.GetLocalizedString(id);
if (MTDictionary.isInstanciated)
{
if (MTDictionary.Instance.DoTranslate(1))
{
str = MTDictionary.Instance.TranslateWord(1, str, this.ToString());
}
}
return str;
}
}
And here is how the localization is set:
C#ChartLocalizer.Active = new GenericChartLocalizer();
Error Details:
System.InvalidCastException was unhandled by user code
HResult=-2147467262
Message=Unable to cast object of type 'Maritech.Translator.Classes.GenericChartLocalizer' to type 'DevExpress.XtraCharts.Localization.ChartResLocalizer'.
Source=DevExpress.XtraCharts.v15.1
StackTrace:
at DevExpress.XtraCharts.Localization.ChartLocalizer.GetDefaultString(ChartStringId id)
at DevExpress.XtraCharts.Palettes.GetPalette(String name)
at DevExpress.XtraCharts.Native.PredefinedPaletteList.get_Item(String name)
at DevExpress.XtraCharts.PaletteRepository.GetPaletteByName(String name)
at DevExpress.XtraCharts.PaletteRepository.get_Item(String name)
at Maritech.Controls.Components.ChartAppearanceManager.InitChartPaletteGallery(GalleryDropDown gallery) in c:\TFS2010\Winforms\MaritechProducts\WiseAnalyzer\WiseAnalyzer5.0\Libraries\UserControls\MaritechControls\Components\DevExHelpers.cs:line 460
at Maritech.Controls.Components.ChartAppearanceManager…ctor(GalleryDropDown paletteGallery, RibbonGalleryBarItem styleGalleryBarItem, BarButtonItem paletteButton) in c:\TFS2010\Winforms\MaritechProducts\WiseAnalyzer\WiseAnalyzer5.0\Libraries\UserControls\MaritechControls\Components\DevExHelpers.cs:line 345
at NemoAnalyzer.AbstractForms.ChildForms.PivotForms.PivotBaseForm.InitChartObjects() in c:\TFS2010\Winforms\MaritechProducts\WiseAnalyzer\WiseAnalyzer5.0\NemoAnalyzer.AbstractForms\ChildForms\BaseForms\PivotBaseForm.cs:line 478
at NemoAnalyzer.AbstractForms.ChildForms.PivotForms.PivotBaseForm.InitPivotAndChart() in c:\TFS2010\Winforms\MaritechProducts\WiseAnalyzer\WiseAnalyzer5.0\NemoAnalyzer.AbstractForms\ChildForms\BaseForms\PivotBaseForm.cs:line 237
at NemoAnalyzer.AbstractForms.ChildForms.PivotForms.PivotBaseForm.PivotBaseForm_Load(Object sender, EventArgs e) in c:\TFS2010\Winforms\MaritechProducts\WiseAnalyzer\WiseAnalyzer5.0\NemoAnalyzer.AbstractForms\ChildForms\BaseForms\PivotBaseForm.cs:line 173
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at DevExpress.XtraEditors.XtraForm.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at DevExpress.XtraEditors.XtraForm.WndProc(Message& msg)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:
Hi Stefan,
Thank you for your report. We will examine this behavior in greater detail and check for a suitable solution. Your patience is appreciated.